Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^3: Net::SSH2 related query

by lune (Monk)
on Nov 20, 2013 at 14:40 UTC ( #1063537=note: print w/replies, xml ) Need Help??

in reply to Re^2: Net::SSH2 related query
in thread Net::SSH2 related query

Just tried again to reproduce your error. First, I am getting the same result (nothing read), if I set the timeout in the select-function too low, say
#select(undef,undef,undef,0.2); select(undef,undef,undef,0.001);
Maybe You should try a higher one?

Second, it seems, that readline (or <>) is always able to read from the channel (no select necessary). The below code works for me. For you too?

my $chan = $ssh->channel() or die "create channel:$!\n"; $chan->shell() or die("open shell: $!\n"); $chan->blocking(0); $chan->write("ls\n") or die("write to channel: $!\n"); while ( <$chan> + ) { print $_; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1063537]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2016-10-28 08:02 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (377 votes). Check out past polls.