Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 19eb7ea

Browse files
authored
fix: inherit current env vars when spawning subprocess on macos (#1964)
1 parent eec21b5 commit 19eb7ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

engine/utils/process/utils.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include "utils/process/utils.h"
22
#include "utils/logging_utils.h"
33

4+
#if defined(__APPLE__) || defined(__linux__)
5+
extern char **environ; // environment variables
6+
#endif
7+
48
namespace cortex::process {
59

610
std::string ConstructWindowsCommandLine(const std::vector<std::string>& args) {
@@ -81,11 +85,7 @@ pid_t SpawnProcess(const std::vector<std::string>& command) {
8185
NULL, // file actions
8286
NULL, // spawn attributes
8387
argv.data(), // argument vector
84-
#if defined(__linux__)
8588
environ // environment (inherit)
86-
#else
87-
NULL
88-
#endif
8989
);
9090

9191
if (spawn_result != 0) {

0 commit comments

Comments
 (0)