in reply to Re: Call external script via ssh with Control::CLI, get output to calling script window
in thread Call external script via ssh with Control::CLI, get output to calling script window

Thanks for the idea, I'll try it out!!

  • Comment on Re^2: Call external script via ssh with Control::CLI, get output to calling script window

Replies are listed 'Best First'.
Re^3: Call external script via ssh with Control::CLI, get output to calling script window
by lgas (Acolyte) on Mar 13, 2016 at 13:12 UTC

    You can use polling mode on cmd() if you set Blocking to 0

    So you could do this:

    $s1_cli->cmd( Command => "/path/to/pre-loader.pl arg1 arg2 2>&1", Blocking => 0 ); do { Time::HiRes::sleep 0.2; ($ok, $output) = $s1_cli->cmd_poll; print $output if length $output; } until $ok;

    Or else this:

    $s1_cli->cmd( Command => "/path/to/pre-loader.pl arg1 arg2 2>&1", Blocking => 0 ); $s1_cli->poll( Poll_code => sub { $output = ($s1_cli->cmd_poll)[1]; print $output if length $output } );