mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
daemon: 'Agent' constructor takes a list of environment variables.
* nix/libutil/util.hh (struct Agent)[Agent]: Add 'env' parameter. * nix/libutil/util.cc (Agent::Agent): Honor it.
This commit is contained in:
parent
4a98735297
commit
2e308238ad
2 changed files with 10 additions and 3 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue