From 13b1661a226f1008a3621fa4ab4f2a8d3ed8b47e Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 8 Feb 2015 16:29:15 +0200 Subject: [PATCH] Rename --no-close to --keep-stderr and make it only preserve stderr --- gruntmaster-exec | 20 +++++++++----------- lib/Gruntmaster/Daemon/Format.pm | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) 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 $!; diff --git a/lib/Gruntmaster/Daemon/Format.pm b/lib/Gruntmaster/Daemon/Format.pm index 227b141..bcfb2a4 100644 --- a/lib/Gruntmaster/Daemon/Format.pm +++ b/lib/Gruntmaster/Daemon/Format.pm @@ -73,7 +73,7 @@ sub mkrun{ get_logger->trace("Running $name..."); my $basename = fileparse $name, qr/[.][^.]*/s; my @args = ('--sudo'); - push @args, '--no-close' if $ENV{TEST_VERBOSE}; + push @args, '--keep-stderr' if $ENV{TEST_VERBOSE}; push @args, '--timeout', $args{timeout} if $args{timeout}; push @args, '--mlimit', $args{mlimit} if $args{mlimit}; push @args, '--olimit', $args{olimit} if $args{olimit}; -- 2.39.2