X-Git-Url: http://git.ieval.ro/?p=gruntmaster-daemon.git;a=blobdiff_plain;f=gruntmaster-exec;fp=gruntmaster-exec;h=b1bcd61bf86fab3496a6b05aa2a0c7a5f249bc22;hp=0a2c50c204c12477cd93d574353fe3a7bdeb80bd;hb=13b1661a226f1008a3621fa4ab4f2a8d3ed8b47e;hpb=c428f2c4b2a81912d7b5bb1db71aceb7c2b4546c diff --git a/gruntmaster-exec b/gruntmaster-exec index 0a2c50c..b1bcd61 100755 --- a/gruntmaster-exec +++ b/gruntmaster-exec @@ -28,16 +28,15 @@ use POSIX qw//; use Text::ParseWords qw/shellwords/; use Time::HiRes qw/alarm/; -my (@fds, $timeout, $mlimit, $olimit, $sudo); -my $close = 1; +my (@fds, $timeout, $mlimit, $olimit, $sudo, $keep_stderr); GetOptions( - "fd=s" => \@fds, - "timeout=f" => \$timeout, - "mlimit=i" => \$mlimit, - "olimit=i" => \$olimit, - "close!" => \$close, - "sudo!" => \$sudo, + "fd=s" => \@fds, + "timeout=f" => \$timeout, + "mlimit=i" => \$mlimit, + "olimit=i" => \$olimit, + "keep-stderr!" => \$keep_stderr, + "sudo!" => \$sudo, ); my $killuser = $ENV{GRUNTMASTER_KILL_USER}; @@ -72,9 +71,8 @@ if ($ret) { exit !say AC, "\nAll OK"; } else { $^F = 50; - if ($close) { - POSIX::close $_ for 0 .. $^F; - } + POSIX::close 2 unless $keep_stderr; + POSIX::close $_ for 0, 1, 3 .. $^F; for my $fdstring (@fds) { my ($fd, $file) = split ' ', $fdstring, 2; open my $fh, $file or die $!;