Re: [Ssh-sftp-perl-users] quick question with regard to exec, take 2
Brought to you by:
dbrobins
From: Thierry C. <thi...@gm...> - 2009-04-03 21:06:18
|
Jeremy Kitchen a écrit : > I'm trying to write a quick program which will execute a series of > commands on the remote system and get each individual exit status back > from the commands. > > It appears the way to go about doing this is to create a new channel, > exec, get the exit status, destroy the channel, exec, get the exit > status, etc. > > However, I *also* want to grab the output of these commands (stdout and > stderr) in real time, so I'm trying to use poll. > > Now, I could be going about this completely the wrong way. If I am, > please let me know :) > > I don't know if you are going the wrong way. However, I don't understand why you are not using ( $out, $err, $exit ) = $ssh->cmd( "$cmd" ); ? You can even execute a complete script shell using sthis syntax: ( $out, $err, $exit ) = $ssh->cmd( "bash", "$myscrypt" ); Isn't it simpler ? |