-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Forward SIGINT to children in uv run on second Ctrl-C
#10989
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
Conversation
| // Ignore signals in the parent process, deferring them to the child. This is safe as long as | ||
| // the command is the last thing that runs in this process; otherwise, we'd need to restore the | ||
| // signal handlers after the command completes. | ||
| let _handler = tokio::spawn(async { while tokio::signal::ctrl_c().await.is_ok() {} }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to figure out what this means for Windows before ready for review.
| _ = int_signal.recv() => { | ||
| int_signal_count += 1; | ||
| if int_signal_count > 1 { | ||
| let _ = interrupt_process(&mut handle); | ||
| } | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to understand why Ctrl-C isn't working in #10952 but works in other cases, but... it seems generally correct to forward a SIGINT if we've received it multiple times (as an escape hatch).
| break result; | ||
| }, | ||
|
|
||
| // TODO(zanieb: Refactor `interrupt_process` and `terminate_process` to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping this separate for review purposes.
There should be two functional changes here: - If we receive SIGINT twice, forward it to the child process - If the `uv run` child process changes its PGID, then forward SIGINT Previously, we never forwarded SIGINT to a child process. Instead, we relied on shell to do so. On Windows, we still do nothing but eat the Ctrl-C events we receive. I cannot see an easy way to send them to the child. The motivation for these changes should be explained in the comments. Closes #10952 (in which Ray changes its PGID) Replaces the (much simpler) #10989 with a more comprehensive approach. See #6738 (comment) for some previous context.
Closes #10952