Skip to content

Commit dc04d83

Browse files
authored
Merge pull request #3002 from ahoppen/pr-5.5/is-not-running-before-termination-handler
[5.5] Set `isRunning` of `Process` to `false` before calling the termination handler
2 parents eec4b26 + 0a4d03c commit dc04d83

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/Foundation/Process.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,9 @@ open class Process: NSObject {
830830
process._terminationReason = .exit
831831
}
832832

833+
// Set the running flag to false
834+
process.isRunning = false
835+
833836
// If a termination handler has been set, invoke it on a background thread
834837

835838
if let terminationHandler = process.terminationHandler {
@@ -839,9 +842,6 @@ open class Process: NSObject {
839842
thread.start()
840843
}
841844

842-
// Set the running flag to false
843-
process.isRunning = false
844-
845845
// Invalidate the source and wake up the run loop, if it's available
846846

847847
CFRunLoopSourceInvalidate(process.runLoopSource)

0 commit comments

Comments
 (0)