aboutsummaryrefslogtreecommitdiff
path: root/src/nix-build
diff options
context:
space:
mode:
authorBernardo Meurer <bernardo@meurer.org>2021-03-03 14:46:15 -0800
committerBernardo Meurer <bernardo@meurer.org>2021-03-04 18:54:45 -0800
commit6e849e3b0a6eb46e6dc65cbd091cc829eab09a5f (patch)
treed3bd8fad203520396f933a36639268d3dbb64105 /src/nix-build
parent665d4ec2dac6734caff9de5b030be123cb7276ef (diff)
nix-build: set execfail
When starting a nix-shell with `-i` it was previously possible for it to silently fail in the scenario where the specified interpreter didn't exist. This happened due to the `exec` call masking the issue. With this change we enable `execfail`, which causes the script using `nix-shell` as interpreter to correctly exit with code 127. Fixes: #4598
Diffstat (limited to 'src/nix-build')
-rwxr-xr-xsrc/nix-build/nix-build.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 7b4a53919..65b85b304 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -447,6 +447,7 @@ static void main_nix_build(int argc, char * * argv)
"unset NIX_ENFORCE_PURITY; "
"shopt -u nullglob; "
"unset TZ; %6%"
+ "shopt -s execfail;"
"%7%",
shellEscape(tmpDir),
(pure ? "" : "p=$PATH; "),