add options for backtick function
This commit is contained in:
parent
1dc9dd6e56
commit
d64643e575
|
@ -120,6 +120,11 @@ sub unix_execute {
|
||||||
my $args = [];
|
my $args = [];
|
||||||
my ($lerror, $stdout, $exit_code);
|
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
|
# Build command line
|
||||||
# Can choose which command is done remotely (can filter and use local file)
|
# Can choose which command is done remotely (can filter and use local file)
|
||||||
if (defined($options{options}->{remote}) &&
|
if (defined($options{options}->{remote}) &&
|
||||||
|
@ -151,16 +156,16 @@ sub unix_execute {
|
||||||
($lerror, $stdout, $exit_code) = backtick(
|
($lerror, $stdout, $exit_code) = backtick(
|
||||||
command => $cmd,
|
command => $cmd,
|
||||||
timeout => $options{options}->{timeout},
|
timeout => $options{options}->{timeout},
|
||||||
wait_exit => 1,
|
wait_exit => $wait_exit,
|
||||||
redirect_stderr => 1
|
redirect_stderr => $redirect_stderr
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
($lerror, $stdout, $exit_code) = backtick(
|
($lerror, $stdout, $exit_code) = backtick(
|
||||||
command => $cmd,
|
command => $cmd,
|
||||||
arguments => [@$args, $sub_cmd],
|
arguments => [@$args, $sub_cmd],
|
||||||
timeout => $options{options}->{timeout},
|
timeout => $options{options}->{timeout},
|
||||||
wait_exit => 1,
|
wait_exit => $wait_exit,
|
||||||
redirect_stderr => 1
|
redirect_stderr => $redirect_stderr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -172,8 +177,8 @@ sub unix_execute {
|
||||||
($lerror, $stdout, $exit_code) = backtick(
|
($lerror, $stdout, $exit_code) = backtick(
|
||||||
command => $cmd,
|
command => $cmd,
|
||||||
timeout => $options{options}->{timeout},
|
timeout => $options{options}->{timeout},
|
||||||
wait_exit => 1,
|
wait_exit => $wait_exit,
|
||||||
redirect_stderr => 1
|
redirect_stderr => $redirect_stderr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,9 @@ sub execute {
|
||||||
sudo => $self->{option_results}->{sudo},
|
sudo => $self->{option_results}->{sudo},
|
||||||
command => $self->{option_results}->{command},
|
command => $self->{option_results}->{command},
|
||||||
command_path => $self->{option_results}->{command_path},
|
command_path => $self->{option_results}->{command_path},
|
||||||
command_options => $options{cmd_options});
|
command_options => $options{cmd_options},
|
||||||
|
redirect_stderr => 0
|
||||||
|
);
|
||||||
|
|
||||||
my $raw_results;
|
my $raw_results;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue