Skip to content

Commit 9e52192

Browse files
committed
fix SIGINT handler in swift-frontend
motivation: fix regression where SIGINT would not terminate frontend processes changes: * call DispatchSourceSignal::resume * call signal(SIGINT, SIG_IGN) rdar://95862616
1 parent 86d081f commit 9e52192

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/swift-driver/main.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ func getExitCode(_ code: Int32) -> Int32 {
4545
}
4646

4747
do {
48-
48+
#if !os(Windows)
49+
signal(SIGINT, SIG_IGN)
50+
#endif
4951
let processSet = ProcessSet()
5052
interruptSignalSource.setEventHandler {
5153
// Terminate running compiler jobs and let the driver exit gracefully, remembering
5254
// to return a corresponding exit code when done.
5355
processSet.terminate()
5456
driverInterrupted = true
5557
}
58+
interruptSignalSource.resume()
5659

5760
if ProcessEnv.vars["SWIFT_ENABLE_EXPLICIT_MODULE"] != nil {
5861
CommandLine.arguments.append("-explicit-module-build")

0 commit comments

Comments
 (0)