File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,13 @@ extension Task {
402402 process. launchPath = self . launchPath
403403 process. arguments = self . arguments
404404
405+ // This is for terminating subprocesses when the parent process exits.
406+ // See https://github.com/Carthage/ReactiveTask/issues/3 for the details.
407+ let selector = Selector ( ( " setStartsNewProcessGroup: " ) )
408+ if process. responds ( to: selector) {
409+ process. perform ( selector, with: false as NSNumber )
410+ }
411+
405412 if let cwd = self . workingDirectoryPath {
406413 process. currentDirectoryPath = cwd
407414 }
@@ -484,8 +491,8 @@ extension Task {
484491 process. standardError = stderrPipe. writeHandle
485492
486493 group. enter ( )
487- process. terminationHandler = { nstask in
488- let terminationStatus = nstask . terminationStatus
494+ process. terminationHandler = { process in
495+ let terminationStatus = process . terminationStatus
489496 if terminationStatus == EXIT_SUCCESS {
490497 // Wait for stderr to finish, then pass
491498 // through stdout.
You can’t perform that action at this time.
0 commit comments