Skip to content

Commit 8893f51

Browse files
authored
Merge pull request #3000 from ahoppen/pr/is-not-running-before-termination-handler
Set `isRunning` of `Process` to `false` before calling the termination handler
2 parents ac17479 + b07ad92 commit 8893f51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/Foundation/Process.swift

+3-3
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)