Skip to content

Commit a886fc2

Browse files
committed
Also pass Path to the Child Process on Windows
Since child processes use `Path` for their dll search path, `Path` should always be passed to children if not already specified.
1 parent 7b72fbd commit a886fc2

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
@@ -445,6 +445,12 @@ open class Process: NSObject {
445445
environment["PWD"] = currentDirectoryURL.path
446446
}
447447

448+
// On Windows, the PATH is required in order to locate dlls needed by
449+
// the process so we should also pass that to the child
450+
if environment["Path"] == nil, let path = ProcessInfo.processInfo.environment["Path"] {
451+
environment["Path"] = path
452+
}
453+
448454
// NOTE(compnerd) the environment string must be terminated by a double
449455
// null-terminator. Otherwise, CreateProcess will fail with
450456
// INVALID_PARMETER.

0 commit comments

Comments
 (0)