Capture compile errors correctly
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon / Format / CPP.pm
index 707af32bfc6b7c04bf7ad587783202b67cb02e24..66deec111f52b2a284ffe61745f29e8621eac0eb 100644 (file)
@@ -27,7 +27,7 @@ sub prepare{
 
   open my $devnull, devnull;
   open my $errors, '>compile-error';
-  my $ret = open3 $devnull, $errors, $errors, 'g++', '-o', $basename, $name;
+  my $ret = open3 $devnull, $errors, undef, 'g++', '-o', $basename, $name;
   local $SIG{ALRM} = sub {kill KILL => $ret};
   alarm 5;
   wait;
@@ -53,10 +53,10 @@ sub run{
        die [DIED, "Crash (SIG$signame)"] if $sig;
        die [NZX, "Non-zero exit status: " . ($? >> 8)] if $?;
   } else {
-       $^F = 50;
-       POSIX::close $_ for 0, 1, 3 .. $^F;
        my @fds = exists $args{fds} ? @{$args{fds}} : ();
        get_logger->trace("Running $basename with fds ". join ' ', @fds);
+       $^F = 50;
+       POSIX::close $_ for 0, 1, 3 .. $^F;
        my $it = natatime 2, @fds;
        while (my ($fd, $file) = $it->()) {
          open my $fh, $file or die $!;
This page took 0.010261 seconds and 4 git commands to generate.