From 399f43c3d5fe91db3a2d6968d8ec30a4d6fbf285 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sat, 7 Apr 2018 22:38:45 -0400 Subject: [PATCH] nix-shell: Fixes use with ruby shebangs. The ported code in 80ebc553eca19dafc64c47420cd49ddd506bc9b7 was incorrectly ported. ``` - $envCommand = "exec $execArgs $interpreter -e 'load(\"$script\")' -- ${\(join ' ', (map shellEscape, @savedArgs))}"; ... + envCommand = (format("exec %1% %2% -e 'load(\"%3%\") -- %4%") % execArgs % interpreter % script % joined.str()).str(); ``` The single-quote finishing the small ruby snippet was lost in translation. --- src/nix-build/nix-build.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc index cf628519c..a63b3e07a 100755 --- a/src/nix-build/nix-build.cc +++ b/src/nix-build/nix-build.cc @@ -212,7 +212,7 @@ void mainWrapped(int argc, char * * argv) // read the shebang to understand which packages to read from. Since // this is handled via nix-shell -p, we wrap our ruby script execution // in ruby -e 'load' which ignores the shebangs. - envCommand = (format("exec %1% %2% -e 'load(\"%3%\") -- %4%") % execArgs % interpreter % script % joined.str()).str(); + envCommand = (format("exec %1% %2% -e 'load(\"%3%\")' -- %4%") % execArgs % interpreter % script % joined.str()).str(); } else { envCommand = (format("exec %1% %2% %3% %4%") % execArgs % interpreter % script % joined.str()).str(); }