Skip to content

Commit 6bdae30

Browse files
committed
TestFoundation: make xdgTestHelper build on Windows
Windows does not have `kill` but it does have `TerminateProcess`. This utility is poorly named at this point and is used as a test helper utility rather than XDG helper specifically.
1 parent 4e0d993 commit 6bdae30

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

TestFoundation/xdgTestHelper/main.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import SwiftFoundation
1212
#else
1313
import Foundation
1414
#endif
15+
#if os(Windows)
16+
import WinSDK
17+
#endif
1518

1619
enum HelperCheckStatus : Int32 {
1720
case ok = 0
@@ -222,7 +225,11 @@ case "--sleep":
222225

223226
case "--signal-self":
224227
if let signalnum = arguments.next(), let signal = Int32(signalnum) {
228+
#if os(Windows)
229+
TerminateProcess(GetCurrentProcess(), UINT(signal))
230+
#else
225231
kill(ProcessInfo.processInfo.processIdentifier, signal)
232+
#endif
226233
}
227234
exit(1)
228235

0 commit comments

Comments
 (0)