-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cargo seems to exit prematurely when "cargo run" receives SIGINT #4397
Comments
Thanks for the report! This is, however, how signals work on Unix. When you hit ctrl-c the shell sends SIGINT to the process group. In the case of Cargo nothing's listening for SIGINT so everything is torn down in a nondeterministic fashion. |
@alexcrichton shouldn't cargo then make the subprocess its own process group before exec()ing the target, so that cargo "just does the right thing"? From a user perspective, this behavior feels very wrong. |
The cargo subprocess and all of its children are already in the same process group, so what you're seeing is actually "the right thing" in terms of intention. The best solution here is handling rust-lang/rustup#806 |
@alexcrichton what does rustup have to do with it? 😕 |
@Svedrin did you install Rust through rustup? If so when you execute |
If I write code that ignores SIGINT, and then send that code an interrupt by hitting
^c
, cargo forwards the signal to the target process but exits prematurely:If I run the target directly,
^c
is correctly ignored without me being dropped back to the shell:I noticed because I had written an application that takes a second or two to clean up when it receives SIGINT. My Cargo version (installed through rustup) is:
The text was updated successfully, but these errors were encountered: