-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: introduce KillSignal
for sending signals to tasks
#131
Conversation
KillSignal
for sending signals to tasks
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.
LGTM, will this help with denoland/deno#18445?
#[tokio::test] | ||
async fn listens_for_signals() { | ||
if cfg!(windows) { | ||
return; // signals are terrible on windows |
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.
🫠
src/shell/commands/executable.rs
Outdated
let _ = child.kill().await; | ||
return ExecuteResult::Continue(signal.aborted_code(), Vec::new(), Vec::new()); |
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.
Should we return the ExecuteResult
with aborted code returned by child.kill()
instead?
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.
Yeah, let's do that.
Yes, I think so. |
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.
LGTM
…ertain tree of execution
TestBuilder::new() | ||
.command(r#"deno eval 'Deno.addSignalListener("SIGINT", () => { console.log("interrupted!"); setTimeout(() => Deno.exit(0), 25); }); setInterval(() => {}, 1000)'"#) | ||
.kill_signal(kill_signal) | ||
.assert_exit_code(0) // signal was handled and a `Deno.exit(0)` was done |
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 improved the handling to return 0
in this case, which makes more sense because the signal was handled.
This is a more advanced and appropriate form of a cancellation token.
For #33