in reply to redirecting output and warning messages
sub my_system { my @cmd = @_; my $pid = fork; defined $pid or die "couldn't fork"; if (!$pid) { open STDOUT, '>>&', \*LOGFILE or exit(1); open STDERR, '>>&', \*LOGFILE or exit(1); exec @cmd1; exit(1); } waitpid($pid, 0); return $? == 0; } my $status1 = my_system($cmd1, @args1); my $status2 = my_system($cmd2, @args2);
|
|---|