From 37b7f1a0d9f70dc7f6b25669495a920be21504cc Mon Sep 17 00:00:00 2001 From: Thien Tran Date: Thu, 13 Feb 2025 16:31:10 +0800 Subject: [PATCH] fix: inherit current env vars when spawning subprocess on macos --- engine/utils/process/utils.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/utils/process/utils.cc b/engine/utils/process/utils.cc index c89dc7371..fef425803 100644 --- a/engine/utils/process/utils.cc +++ b/engine/utils/process/utils.cc @@ -1,6 +1,10 @@ #include "utils/process/utils.h" #include "utils/logging_utils.h" +#if defined(__APPLE__) || defined(__linux__) +extern char **environ; // environment variables +#endif + namespace cortex::process { std::string ConstructWindowsCommandLine(const std::vector& args) { @@ -81,11 +85,7 @@ pid_t SpawnProcess(const std::vector& command) { NULL, // file actions NULL, // spawn attributes argv.data(), // argument vector -#if defined(__linux__) environ // environment (inherit) -#else - NULL -#endif ); if (spawn_result != 0) {