-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Command::new("cargo-zigbuild") doesn't shutdown when aborting #194
Comments
oh, my compilation machine OS is mac ventura 13.4 if that's useful. |
You are welcome to investigate and send PRs to fix it. |
For anyone else that encounters this you can use https://docs.rs/command-group/latest/command_group/index.html to spawn cargo-zigbuild in a process group which then can be killed. This is what a terminal does (and why ctrl-c works as expected). It may still be a good idea to add a custom ctrl-c handler to cargo-zigbuild to make this usecase easier. For those that don't want to use command_group you can use the following. // Set the process group to the child's process ID (works only on unix systems)
command.process_group(0);
...
// Perform the kill by sending a signal to the *process group* instead of just the one process.
// signal is from the nix crate
signal::killpg(Pid::from_raw(child.id() as _), Signal::SIGINT).unwrap(); // note the signal used here can be changed if needed.
// continue with child cleanup like .wait() |
This worked! Thank you so much! I forked zigbuild and i tried for several hours, but i don't have enough experience to make this feature work. |
It prints Ok(()) to console, but continues running.
tried the following as well: (both std::process and tokio::process have the same issue)
The following works:
I asked the rust community, they think this behaviour is weird. This is what they suggested the issue was:
I need the correct behaviour for automating my builds, and allow it to abort on an external signal. thank you!
The text was updated successfully, but these errors were encountered: