summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-06-10 11:30:34 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-06-10 11:30:34 +0000
commitf24cf5d303dac3e82068f80091d2f312455ba8cf (patch)
treedb30d7d9adc4f885166e41b26c2d22a663233701 /scripts
parentc6cb792d48a8b4290df15202ec30b06a3383dc6a (diff)
downloadguix-f24cf5d303dac3e82068f80091d2f312455ba8cf.tar.gz
* nix-build: if nix-instantiate or nix-store fails due to a signal
  (e.g. out of memory or a segfault), print an error message.
  Otherwise the user doesn't see anything.

Diffstat (limited to 'scripts')
-rw-r--r--scripts/nix-build.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index d90b902aeb..458b333f3e 100644
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -142,7 +142,10 @@ foreach my $expr (@exprs) {
     # !!! would prefer the perl 5.8.0 pipe open feature here.
     my $pid = open(DRVPATHS, "-|") || exec "$binDir/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
     while (<DRVPATHS>) {chomp; push @drvPaths, $_;}
-    close DRVPATHS or exit 1;
+    if (!close DRVPATHS) {
+        die "nix-instantiate killed by signal " . ($? & 127) . "\n" if ($? & 127);
+        exit 1;
+    }
 
     foreach my $drvPath (@drvPaths) {
         my $target = readlink $drvPath or die "cannot read symlink `$drvPath'";
@@ -154,7 +157,10 @@ foreach my $expr (@exprs) {
     $pid = open(OUTPATHS, "-|") || exec "$binDir/nix-store", "--add-root", $outLink, "--indirect", "-rv",
         @buildArgs, @drvPaths;
     while (<OUTPATHS>) {chomp; push @outPaths, $_;}
-    close OUTPATHS or exit 1;
+    if (!close OUTPATHS) {
+        die "nix-store killed by signal " . ($? & 127) . "\n" if ($? & 127);
+        exit 1;
+    }
 
     next if $dryRun;