Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Kill subprocesses correctly on each platform on Ctrl-C#13

Merged
LPGhatguy merged 7 commits into
mainfrom
unix-kill-process
May 24, 2022
Merged

Kill subprocesses correctly on each platform on Ctrl-C#13
LPGhatguy merged 7 commits into
mainfrom
unix-kill-process

Conversation

@LPGhatguy

Copy link
Copy Markdown
Owner

On Unix, process groups don't reap child processes when the parent process dies. Windows job groups do!

This PR introduces a separate code path for Unix systems that uses tokio's process API instead, and wires up a few signals to explicitly kill the child process.

@LPGhatguy LPGhatguy marked this pull request as ready for review May 24, 2022 22:39
@LPGhatguy LPGhatguy merged commit d3f8d1f into main May 24, 2022
@LPGhatguy LPGhatguy deleted the unix-kill-process branch May 24, 2022 23:32
afujiwara-roblox added a commit to Roblox/foreman that referenced this pull request Oct 9, 2023
Running commands like "rojo serve" and pressing ctrl-c does not kill the
rojo process as intended. Foreman should pass the signal to the tools it
runs. This PR implements the same solution from
[Aftman](LPGhatguy/aftman#13)

Manually tested ctrl-c kills subprocesses on M2 mac and Windows machines
Added 2 scripts to CI to test subprocess are properly killed on linux
and windows machines
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant