Skip to content

Commit 9826fc2

Browse files
John ButeJohn Bute
authored andcommitted
Fixed bug where child process did not set parent process back to foreground
1 parent 46f7e38 commit 9826fc2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/SwiftlyCore/Platform.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ extension Platform {
211211
}
212212
process.waitUntilExit()
213213

214+
if pgid != -1 {
215+
tcsetpgrp(STDOUT_FILENO, pgid)
216+
}
217+
214218
guard process.terminationStatus == 0 else {
215219
throw RunProgramError(exitCode: process.terminationStatus, program: args.first!)
216220
}
@@ -254,6 +258,10 @@ extension Platform {
254258

255259
process.waitUntilExit()
256260

261+
if pgid != -1 {
262+
tcsetpgrp(STDOUT_FILENO, pgid)
263+
}
264+
257265
guard process.terminationStatus == 0 else {
258266
throw RunProgramError(exitCode: process.terminationStatus, program: args.first!)
259267
}

0 commit comments

Comments
 (0)