Rename --no-close to --keep-stderr and make it only preserve stderr
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 8 Feb 2015 14:29:15 +0000 (16:29 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 8 Feb 2015 14:30:31 +0000 (16:30 +0200)
gruntmaster-exec
lib/Gruntmaster/Daemon/Format.pm

index 0a2c50c204c12477cd93d574353fe3a7bdeb80bd..b1bcd61bf86fab3496a6b05aa2a0c7a5f249bc22 100755 (executable)
@@ -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 $!;
index 227b14149a2ae8a72d1d58404a2648cd3b07101d..bcfb2a4ebfe0a48db0adefe1bf3ef4583ea3db8f 100644 (file)
@@ -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};
This page took 0.012707 seconds and 4 git commands to generate.