Verified Commit 36421bff authored by Vladimír Štill's avatar Vladimír Štill
Browse files

makefilter: Capture stderr too

parent 132d6648
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
use warnings; use warnings;
use strict; use strict;
use Term::ANSIColor; use Term::ANSIColor;
use IPC::Open3;
use v5.16; use v5.16;
$|++; $|++;
open(my $full, ">", "make-full.log"); open(my $full, ">", "make-full.log");
open(my $make, "-|", @ARGV); my $pid = open3('<&STDIN', my $make, undef, @ARGV);
my $cut = 0; my $cut = 0;
while (<$make>) { while (<$make>) {
...@@ -19,9 +20,12 @@ while (<$make>) { ...@@ -19,9 +20,12 @@ while (<$make>) {
say "[[[log cut by makefilter, full log in make-full.log]]]"; say "[[[log cut by makefilter, full log in make-full.log]]]";
} }
} }
if (not close($make)) {
my $exit = $? >> 8; waitpid($pid, 0);
my $sig = $? & 0xff; my $sig = $? & 0xff;
die "Error closing handle to make: $!" if $! != 0; if ( $sig ) {
exit $exit + $sig; say colored("Killed by signal $sig", 'bright_red');
exit $sig;
} }
my $exit = $? >> 8;
exit $exit;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment