Skip to content

Commit 10ac066

Browse files
gmittertaciidgh
authored andcommitted
Implement SwiftTool.swift on Windows
1 parent d5c5b86 commit 10ac066

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/Commands/SwiftTool.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,19 +387,23 @@ public class SwiftTool<Options: ToolOptions> {
387387
// Terminate all processes on receiving an interrupt signal.
388388
processSet.terminate()
389389

390+
#if os(Windows)
391+
// Exit as if by signal()
392+
TerminateProcess(GetCurrentProcess(), 3)
393+
#elseif os(macOS)
390394
// Install the default signal handler.
391395
var action = sigaction()
392-
#if os(macOS)
393396
action.__sigaction_u.__sa_handler = SIG_DFL
397+
sigaction(SIGINT, &action, nil)
398+
kill(getpid(), SIGINT)
394399
#else
400+
var action = sigaction()
395401
action.__sigaction_handler = unsafeBitCast(
396402
SIG_DFL,
397403
to: sigaction.__Unnamed_union___sigaction_handler.self)
398-
#endif
399404
sigaction(SIGINT, &action, nil)
400-
401-
// Die with sigint.
402405
kill(getpid(), SIGINT)
406+
#endif
403407
}
404408
self.processSet = processSet
405409

0 commit comments

Comments
 (0)