Skip to content

Commit cce8e65

Browse files
authored
Merge pull request #2385 from gmittert/DontLetChildrenGetLost
Also pass Path to the Child Process on Windows
2 parents 189a90d + a886fc2 commit cce8e65

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Foundation/Process.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ open class Process: NSObject {
469469
environment["PWD"] = currentDirectoryURL.path
470470
}
471471

472+
// On Windows, the PATH is required in order to locate dlls needed by
473+
// the process so we should also pass that to the child
474+
if environment["Path"] == nil, let path = ProcessInfo.processInfo.environment["Path"] {
475+
environment["Path"] = path
476+
}
477+
472478
// NOTE(compnerd) the environment string must be terminated by a double
473479
// null-terminator. Otherwise, CreateProcess will fail with
474480
// INVALID_PARMETER.

0 commit comments

Comments
 (0)