add options for backtick function
This commit is contained in:
parent
1dc9dd6e56
commit
d64643e575
|
@ -119,6 +119,11 @@ sub unix_execute {
|
|||
my $cmd = '';
|
||||
my $args = [];
|
||||
my ($lerror, $stdout, $exit_code);
|
||||
|
||||
my $redirect_stderr = 1;
|
||||
$redirect_stderr = $options{redirect_stderr} if (defined($options{redirect_stderr}));
|
||||
my $wait_exit = 1;
|
||||
$wait_exit = $options{wait_exit} if (defined($options{wait_exit}));
|
||||
|
||||
# Build command line
|
||||
# Can choose which command is done remotely (can filter and use local file)
|
||||
|
@ -149,19 +154,19 @@ sub unix_execute {
|
|||
if (defined($options{ssh_pipe}) && $options{ssh_pipe} == 1) {
|
||||
$cmd = "echo '" . $sub_cmd . "' | " . $cmd . ' ' . join(" ", @$args);
|
||||
($lerror, $stdout, $exit_code) = backtick(
|
||||
command => $cmd,
|
||||
timeout => $options{options}->{timeout},
|
||||
wait_exit => 1,
|
||||
redirect_stderr => 1
|
||||
);
|
||||
command => $cmd,
|
||||
timeout => $options{options}->{timeout},
|
||||
wait_exit => $wait_exit,
|
||||
redirect_stderr => $redirect_stderr
|
||||
);
|
||||
} else {
|
||||
($lerror, $stdout, $exit_code) = backtick(
|
||||
command => $cmd,
|
||||
arguments => [@$args, $sub_cmd],
|
||||
timeout => $options{options}->{timeout},
|
||||
wait_exit => 1,
|
||||
redirect_stderr => 1
|
||||
);
|
||||
command => $cmd,
|
||||
arguments => [@$args, $sub_cmd],
|
||||
timeout => $options{options}->{timeout},
|
||||
wait_exit => $wait_exit,
|
||||
redirect_stderr => $redirect_stderr
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$cmd = 'sudo ' if (defined($options{sudo}));
|
||||
|
@ -170,11 +175,11 @@ sub unix_execute {
|
|||
$cmd .= $options{command_options} if (defined($options{command_options}));
|
||||
|
||||
($lerror, $stdout, $exit_code) = backtick(
|
||||
command => $cmd,
|
||||
timeout => $options{options}->{timeout},
|
||||
wait_exit => 1,
|
||||
redirect_stderr => 1
|
||||
);
|
||||
command => $cmd,
|
||||
timeout => $options{options}->{timeout},
|
||||
wait_exit => $wait_exit,
|
||||
redirect_stderr => $redirect_stderr
|
||||
);
|
||||
}
|
||||
|
||||
if (defined($options{options}->{show_output}) &&
|
||||
|
|
|
@ -132,7 +132,9 @@ sub execute {
|
|||
sudo => $self->{option_results}->{sudo},
|
||||
command => $self->{option_results}->{command},
|
||||
command_path => $self->{option_results}->{command_path},
|
||||
command_options => $options{cmd_options});
|
||||
command_options => $options{cmd_options},
|
||||
redirect_stderr => 0
|
||||
);
|
||||
|
||||
my $raw_results;
|
||||
|
||||
|
|
Loading…
Reference in New Issue