in reply to Re: SSH Command output
in thread Asynchronous Processing a command execution
The above code only prints for me the first 2 lines of the ping command after execution. What is wrong ?close STDOUT; close STDERR; $ssh=Net::SSH::Perl->new("113.128.160.214"); $ssh->login($UNM,$Pass); $cmd="ping 114.9.36.142"; $ssh->register_handler(SSH_SMSG_STDOUT_DATA,sub{($ssh,$packetout)=@_;p +ush(@output,$packetout->get_str);$cache->set($session,[0,@output])}); #$ssh->register_handler(SSH_SMSG_EXITSTATUS,sub{($ssh,$packetexit)=@_; +$cache->set($session,[1,$packetexit->get_str])}); ($stdout,$stderr,$exit)=$ssh->cmd($cmd);
|
|---|