aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-05-08 14:17:32 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-05-08 14:17:32 +0200
commita887892eb607d45de47e77aeb1a756f7672395b6 (patch)
tree7bb54e4f491175e21e524a74cddcda0017e90566 /src
parent54e54db2e2929632ae30af314185c084060cfca9 (diff)
nix-shell: Don't fail if run from a path containing the string "nix-shell"
Diffstat (limited to 'src')
-rwxr-xr-xsrc/nix-build/nix-build.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 618895d38..5b8e816d8 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -106,7 +106,7 @@ static void _main(int argc, char * * argv)
// Heuristic to see if we're invoked as a shebang script, namely,
// if we have at least one argument, it's the name of an
// executable file, and it starts with "#!".
- if (runEnv && argc > 1 && !std::regex_search(argv[1], std::regex("nix-shell"))) {
+ if (runEnv && argc > 1 && !std::regex_search(baseNameOf(argv[1]), std::regex("nix-shell"))) {
script = argv[1];
try {
auto lines = tokenizeString<Strings>(readFile(script), "\n");