in reply to Printing Output From Net::SSH2 exec

I've got a code segment like this (for use on Win32):
. . my $ssh2 = Net::SSH2->new(); $ssh2->connect('xxx.xxx.xxx.xxx') or die; $ssh2->auth_password('user','pass') or die "Unable to login $! \n"; my $chan1 = $ssh2->channel(); $chan1->blocking(1); $chan1->exec('echo $PATH'); $chan1->read($buf, $buflen); print "BUF: $buf\n"; $chan1->close; . .
You might see if there's anything there that helps.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Printing Output From Net::SSH2 exec
by vortura (Initiate) on May 14, 2009 at 10:50 UTC

    I've messed around a lot with blocking and non-blocking connections without much luck, but I'll give your code segment a go.

    Thanks, R