Skip to content

Commit 2742168

Browse files
DougGregorcompnerd
andauthored
Fix the Windows build of the swift-parser-test tool
Thank you @compnerd! Co-authored-by: Saleem Abdulrasool <[email protected]>
1 parent 70dbfa6 commit 2742168

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/swift-parser-test/swift-parser-test.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import SwiftSyntax
1515
import SwiftParser
1616
import Foundation
1717
import ArgumentParser
18+
#if os(Windows)
19+
import WinSDK
20+
#endif
1821

1922
enum CommonError: Swift.Error {
2023
case readingSourceFileFailed(URL)
@@ -229,7 +232,11 @@ class Reduce: ParsableCommand {
229232

230233
try process.run()
231234
if sema.wait(timeout: DispatchTime.now() + .seconds(1)) == .timedOut {
235+
#if os(Windows)
236+
_ = TerminateProcess(process.processHandle, 0)
237+
#else
232238
kill(pid_t(process.processIdentifier), SIGKILL)
239+
#endif
233240
return .timeout
234241
}
235242
switch process.terminationStatus {

0 commit comments

Comments
 (0)