|
our $VERSION = '1.16.0' ;
sub new {
my $that = shift ;
my $proto = ref ( $that ) || $that ;
my $self = { @_ };
bless ( $self , $proto );
return $self ;
}
sub _exec {
my ( $self , $exec , $option ) = @_ ;
my ( $out , $err , $pid , $out_fh , $err_fh );
my $ssh = Rex::is_ssh();
my $tty = !Rex::Config->get_no_tty;
( undef , $out_fh , $err_fh , $pid ) = $ssh ->open3( { tty => $tty }, $exec );
( $out , $err ) = $self ->io_read( $out_fh , $err_fh , $pid , $option );
waitpid ( $pid , 0 ) or die ($!);
if ( $ssh ->error || $? ) {
$? >>= 8;
}
return ( $out , $err );
}
1;
|