chiark / gitweb /
better error messages from pipethrough_*
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Tue, 28 Jul 2009 17:14:58 +0000 (18:14 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Tue, 28 Jul 2009 17:14:58 +0000 (18:14 +0100)
pctb/Commods.pm
pctb/commod-email-processor

index 183eb9655607aaa5044d28c25b7c30e7e8241925..d9a2a948155c314692a9c83d46fe7daeea7cfa09 100644 (file)
@@ -206,14 +206,14 @@ sub pipethrough_run_along ($$$@) {
     if (!$child) {
        open STDIN, "<&", $tf;
        &$childprep() if defined $childprep;
-       exec $cmd @a; die $!;
+       exec $cmd @a; die "@a $!";
     }
     return $fh;
 }
-sub pipethrough_run_finish ($) {
-    my ($fh)= @_;
+sub pipethrough_run_finish ($$) {
+    my ($fh, $what)= @_;
     $fh->error and die $!;
-    close $fh or die "$! $?";  die $? if $?;
+    close $fh or die "$what $! $?";  die $? if $?;
 }
 
 sub pipethrough_run ($$$@) {
@@ -222,7 +222,7 @@ sub pipethrough_run ($$$@) {
     my $r;
     { undef $/; $!=0; $r= <$pt>; }
     defined $r or die $!;
-    pipethrough_run_finish($pt);
+    pipethrough_run_finish($pt, "@a");
     return $r;
 }
 sub pipethrough_run_gzip ($) {
index 28a7082ca640878c5fa46fcbf3dec8a0a8c81aa7..b7883fc69e574e9331c30c80ff76cf810bb68f77 100755 (executable)
@@ -161,7 +161,7 @@ sub main () {
        
     }
 
-    pipethrough_run_finish($pt);
+    pipethrough_run_finish($pt, 'gunzip <$deduped_tsv.gz');
 
 }