transfer environment to child process

This commit is contained in:
Kelvin Sherlock 2016-02-03 15:06:48 -05:00
parent 2fda21a349
commit e3ed9dec46
2 changed files with 10 additions and 1 deletions

View File

@ -67,7 +67,14 @@ namespace {
if (pid == 0) {
// also export environment...
// export environment...
for (const auto &kv : env) {
if (kv.second) { // exported
std::string name = "mpw$" + kv.first;
setenv(name.c_str(), kv.second.c_str(), 1);
}
}
// handle any indirection...
fds.dup();

View File

@ -17,6 +17,8 @@ public:
operator const std::string&() const { return value; }
operator std::string&() { return value; }
const char *c_str() const { return value.c_str(); }
EnvironmentEntry() = default;
EnvironmentEntry(const EnvironmentEntry &) = default;
EnvironmentEntry(EnvironmentEntry &&) = default;