my $logfunc;
my $input;
my $output;
+ my $afterfork;
eval {
$errfunc = $param{$p};
} elsif ($p eq 'logfunc') {
$logfunc = $param{$p};
+ } elsif ($p eq 'afterfork') {
+ $afterfork = $param{$p};
} else {
die "got unknown parameter '$p' for run_command\n";
}
local $SIG{ALRM} = sub { die "got timeout\n"; } if $timeout;
$oldtimeout = alarm($timeout) if $timeout;
+ &$afterfork() if $afterfork;
+
if (ref($writer)) {
print $writer $input if defined $input;
close $writer;