watchexec / command-group

Deprecated: use process-wrap. || Extension to Command to spawn in a process group
https://docs.rs/command-group
Other
37 stars 10 forks source link

Wait for all processes in the process group #7

Closed malyn closed 1 year ago

malyn commented 1 year ago

This avoids zombie processes that would otherwise be created if the child process exits after spawning its own children, but without waiting for those children to exit. This change ensures that wait reaps all of those zombie processes, while still returning the exit code from the original process that was spawned (Command Group's direct child).

One note: I wasn't entirely sure if this should be in Command Group or in my application code, but the documentation of the AsyncGroupChild::wait function suggested that cleaning up all of the children in the process group might have been what was intended:

Waits for the child group to exit completely, returning the status that the process leader exited with.

The Tokio code does not perform this reaping though, and I realize that Command Group is ultimately based on the Tokio API, so, as I said, not entirely sure if this is the right place for this logic.

passcod commented 1 year ago

Thank you!

passcod commented 1 year ago

bors r+

bors[bot] commented 1 year ago

Build failed: