Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
May 24, 2022

Conversation

LPGhatguy
Copy link
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant