about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-24T16·25+0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-24T16·25+0100
commitd3e1aad421a88a7a075cac25142c49224b3ecca2 (patch)
tree1bb5e4edcdd69ac4777aa49087e9a53317e4d690
parente76df9bd5285272f025025d97fe8993156726eef (diff)
nix-shell: Better error message when the shell can't be started
-rwxr-xr-xsrc/nix-build/nix-build.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index f4484ba572d3..b81c98868e61 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -448,15 +448,17 @@ int main(int argc, char ** argv)
 
                 auto envPtrs = stringsToCharPtrs(envStrs);
 
+                auto shell = getEnv("NIX_BUILD_SHELL", "bash");
+
                 environ = envPtrs.data();
 
                 auto argPtrs = stringsToCharPtrs(args);
 
                 restoreSignals();
 
-                execvp(getEnv("NIX_BUILD_SHELL", "bash").c_str(), argPtrs.data());
+                execvp(shell.c_str(), argPtrs.data());
 
-                throw SysError("executing shell");
+                throw SysError("executing shell ‘%s’", shell);
             }
 
             // Ugly hackery to make "nix-build -A foo.all" produce symlinks