diff --git a/Source/Processes/AuProcess.Unix.cpp b/Source/Processes/AuProcess.Unix.cpp index 1ff30dbc..45511926 100644 --- a/Source/Processes/AuProcess.Unix.cpp +++ b/Source/Processes/AuProcess.Unix.cpp @@ -481,8 +481,35 @@ namespace Aurora::Processes } #endif - ::setsid(); + if (this->type_ != ESpawnType::eSpawnOvermap) + { + ::setsid(); + } + + if (!this->startup_.bInheritEnvironmentVariables) + { + try + { + AuList keys; + + for (const auto &[key, value] : AuProcess::EnvironmentGetAll()) + { + keys.push_back(key); + } + AuProcess::EnvironmentRemoveMany(keys); + } + catch (...) + { + SysPanic("Couldn't fork"); + } + } + + if (this->startup_.environmentVariables.size()) + { + SysAssert(AuProcess::EnvironmentSetMany(this->startup_.environmentVariables)); + } + #if defined(AURORA_IS_XNU_DERIVED) if (this->startup_.workingDirectory) {