Skip to content

Commit ede125c

Browse files
authored
Add Process.processID on Windows to match other OS (#100)
SwiftDriver uses `processID` and currently does not compile on Windows, because this property is absent
1 parent f0017d7 commit ede125c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/TSCBasic/Process.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ public final class Process: ObjectIdentifierProtocol {
177177
/// Typealias for process id type.
178178
#if !os(Windows)
179179
public typealias ProcessID = pid_t
180+
#else
181+
public typealias ProcessID = Int32
180182
#endif
181183

182184
/// Typealias for stdout/stderr output closure.
@@ -206,6 +208,9 @@ public final class Process: ObjectIdentifierProtocol {
206208
/// The process id of the spawned process, available after the process is launched.
207209
#if os(Windows)
208210
private var _process: Foundation.Process?
211+
public var processID: ProcessID {
212+
return _process?.processIdentifier ?? 0
213+
}
209214
#else
210215
public private(set) var processID = ProcessID()
211216
#endif

0 commit comments

Comments
 (0)