nix-shell: Better error message when the shell can't be started

This commit is contained in:
Eelco Dolstra 2017-02-24 17:25:00 +01:00
parent e76df9bd52
commit d3e1aad421
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -448,15 +448,17 @@ int main(int argc, char ** argv)
auto envPtrs = stringsToCharPtrs(envStrs); auto envPtrs = stringsToCharPtrs(envStrs);
auto shell = getEnv("NIX_BUILD_SHELL", "bash");
environ = envPtrs.data(); environ = envPtrs.data();
auto argPtrs = stringsToCharPtrs(args); auto argPtrs = stringsToCharPtrs(args);
restoreSignals(); 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 // Ugly hackery to make "nix-build -A foo.all" produce symlinks