File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -20,19 +20,20 @@ import Glibc
20
20
#endif
21
21
import TSCBasic
22
22
23
+ import Dispatch
24
+
23
25
#if os(Windows)
24
26
import WinSDK
25
27
#endif
26
28
27
29
import enum TSCUtility. Diagnostics
28
- import typealias TSCUtility. InterruptHandler
29
30
30
- var intHandler : InterruptHandler ?
31
+ let interruptSignalSource = DispatchSource . makeSignalSource ( signal : SIGINT )
31
32
let diagnosticsEngine = DiagnosticsEngine ( handlers: [ Driver . stderrDiagnosticsHandler] )
32
33
var driverInterrupted = false
33
34
func getExitCode( _ code: Int32 ) -> Int32 {
34
35
if driverInterrupted {
35
- intHandler = nil
36
+ interruptSignalSource . cancel ( )
36
37
#if os(Windows)
37
38
TerminateProcess ( GetCurrentProcess ( ) , UINT ( 0xC0000000 | UINT ( 2 ) ) )
38
39
#else
@@ -46,7 +47,7 @@ func getExitCode(_ code: Int32) -> Int32 {
46
47
do {
47
48
48
49
let processSet = ProcessSet ( )
49
- intHandler = try InterruptHandler {
50
+ interruptSignalSource . setEventHandler {
50
51
// Terminate running compiler jobs and let the driver exit gracefully, remembering
51
52
// to return a corresponding exit code when done.
52
53
processSet. terminate ( )
You can’t perform that action at this time.
0 commit comments