Skip to content

Raise command signal to the current process #698

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

Merged
merged 2 commits into from
Jun 8, 2025

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Jun 6, 2025

Fixes #496.

@GuillaumeGomez GuillaumeGomez force-pushed the signal branch 3 times, most recently from 4f701d3 to b6082d1 Compare June 6, 2025 14:59
#[cfg(unix)]
{
let error = crate::utils::get_command_inner(input, None, Some(env)).exec();
eprintln!("Command failed: {error:?}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rephrase the error to make this clear that it's the execvp syscall that failed.

@antoyo
Copy link
Contributor

antoyo commented Jun 6, 2025

Nice work!
This has the correct behavior, but just to make sure I understand, does this work because of the call to exec()?
If so, could you please document why we call exec() (i.e. to forward the signals)?

… they exit because of a signal, it will be displayed at the top level
@GuillaumeGomez
Copy link
Member Author

Updated error message.

@GuillaumeGomez
Copy link
Member Author

Added docs too.

@antoyo antoyo merged commit 485e43f into rust-lang:master Jun 8, 2025
38 checks passed
@antoyo
Copy link
Contributor

antoyo commented Jun 8, 2025

Thanks a lot for your contribution!
This is a very nice improvement!

@GuillaumeGomez GuillaumeGomez deleted the signal branch June 8, 2025 17:35
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.

y.sh cargo run swallows the signal emitted by the running process
2 participants