aboutsummaryrefslogtreecommitdiff
path: root/src/nix-store/nix-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-10-25 13:01:50 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-10-25 13:01:50 +0200
commit2d5b1b24bf70a498e4c0b378704cfdb6471cc699 (patch)
tree80e7c28cb3431ed6a3fbb080f769f9016ea564c5 /src/nix-store/nix-store.cc
parentac12517f3e969db9fb4834fdfd2da63101ffd3de (diff)
Pass lists/attrsets to bash as (associative) arrays
Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r--src/nix-store/nix-store.cc11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 85bcbc22e..f6f276dd1 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -440,15 +440,6 @@ static void opQuery(Strings opFlags, Strings opArgs)
}
-static string shellEscape(const string & s)
-{
- string r;
- for (auto & i : s)
- if (i == '\'') r += "'\\''"; else r += i;
- return r;
-}
-
-
static void opPrintEnv(Strings opFlags, Strings opArgs)
{
if (!opFlags.empty()) throw UsageError("unknown flag");
@@ -460,7 +451,7 @@ static void opPrintEnv(Strings opFlags, Strings opArgs)
/* Print each environment variable in the derivation in a format
that can be sourced by the shell. */
for (auto & i : drv.env)
- cout << format("export %1%; %1%='%2%'\n") % i.first % shellEscape(i.second);
+ cout << format("export %1%; %1%=%2%\n") % i.first % shellEscape(i.second);
/* Also output the arguments. This doesn't preserve whitespace in
arguments. */