1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| sub open_execute_command
{
my ($fh, $cmd, $mode, $safe) = @_;
$fh = &callers_package($fh);
my $realcmd = &translate_command($cmd);
if (&is_readonly_mode() && !$safe) {
# Don't actually run it
print STDERR "vetoing command $cmd\n";
$? = 0;
if ($mode == 0) {
return open($fh, ">$null_file");
}
else {
return open($fh, $null_file);
}
}
# Really run it
&webmin_debug_log('CMD', "cmd=$realcmd mode=$mode")
if ($gconfig{'debug_what_cmd'});
if ($mode == 0) {
return open($fh, "| $cmd");
}
elsif ($mode == 1) {
return open($fh, "$cmd 2>$null_file |");
}
elsif ($mode == 2) {
return open($fh, "$cmd 2>&1 |");
}
} |
Partager