Quoth (e-mail address removed) (Gary E. Ansok):
I don't really understand what you were trying to do. If you are running
a remote shell without a pty, you *don't* get any indication that the
command has completed. You certainly don't get EOF: the connection is
still open, waiting for another command. If you need an indication, you
need to either use the ->exec method or arrange to have something
printed after each command has finished. A quick but somewhat dirty way
of doing this is to request a pty, which will cause the remote shell to
start printing prompts.
Well, perhaps I wasn't doing it correctly. I was creating a new
channel and then using $chan->exec($cmd), but was having trouble
getting the complete output and detecting when the remote command
finished. (The remote command could be as simple as a script with
"sleep 2; ls".)
As I mentioned, I had an existing version using Net::SSH:
erl, so there
wasn't a massive need to switch over. We were having performance issues,
but ended up solving those by upgrading the bigint libraries (I think
there was some glitch in the installation of the eearlier versions).
I think you want Net::SFTP, which implements the ssh2 sftp functionality
on top of Net::SSH:
erl. SFTP is what scp(1) actually uses if it's
running over ssh2.
Thanks for the info -- I'd looked at that in the past, but at the time
we were having performance issues centered on the initial connection,
so only doing one connection was important. (I don't see a way to use
an existing Net::SSH:
erl connection in Net::SFTP, or a supported way to
use the connection from Net::SFTP for other uses.) Still, it's something
I'll look at again if I need to update this code.
Gary