summary refs log tree commit diff
path: root/nix/libutil/util.cc
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-12-13 01:10:06 +0100
committerMarius Bakke <marius@gnu.org>2020-12-13 01:10:06 +0100
commita7737f0ead2293536b9d0ba253de4673378a0ffa (patch)
treecf80318b0a9903aa56a69c316659a52f94abbe27 /nix/libutil/util.cc
parentba47c83570b6d1824738ef5ff8580e7581990699 (diff)
parent1adeb744560af94687eb7c3780c7145c52674070 (diff)
downloadguix-a7737f0ead2293536b9d0ba253de4673378a0ffa.tar.gz
Merge branch 'master' into ungrafting
Diffstat (limited to 'nix/libutil/util.cc')
-rw-r--r--nix/libutil/util.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index 59a2981359..69f1c634a9 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -1173,7 +1173,7 @@ void commonChildInit(Pipe & logPipe)
 
 //////////////////////////////////////////////////////////////////////
 
-Agent::Agent(const string &command, const Strings &args)
+Agent::Agent(const string &command, const Strings &args, const std::map<string, string> &env)
 {
     debug(format("starting agent '%1%'") % command);
 
@@ -1191,6 +1191,10 @@ Agent::Agent(const string &command, const Strings &args)
 
         commonChildInit(fromAgent);
 
+	for (auto pair: env) {
+	    setenv(pair.first.c_str(), pair.second.c_str(), 1);
+	}
+
         if (chdir("/") == -1) throw SysError("changing into `/");
 
         /* Dup the communication pipes. */