From f24cf5d303dac3e82068f80091d2f312455ba8cf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 10 Jun 2009 11:30:34 +0000 Subject: [PATCH] * 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. --- scripts/nix-build.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/nix-build.in b/scripts/nix-build.in index d90b902ae..458b333f3 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 () {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 () {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;