assign environ to a temp variable to ensure liveness
This commit is contained in:
parent
8079ab87a2
commit
c0d55f9183
|
@ -446,10 +446,13 @@ int main(int argc, char ** argv)
|
|||
? Strings{"bash", "--rcfile", rcfile}
|
||||
: Strings{"bash", rcfile};
|
||||
|
||||
environ = stringsToCharPtrs(envStrs).data();
|
||||
auto envPtrs = stringsToCharPtrs(envStrs);
|
||||
|
||||
execvp(getEnv("NIX_BUILD_SHELL", "bash").c_str(),
|
||||
stringsToCharPtrs(args).data());
|
||||
environ = envPtrs.data();
|
||||
|
||||
auto argPtrs = stringsToCharPtrs(args);
|
||||
|
||||
execvp(getEnv("NIX_BUILD_SHELL", "bash").c_str(), argPtrs.data());
|
||||
|
||||
throw SysError("executing shell");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue