1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-18 03:44:05 -05:00

fix(task): do not always kill child on ctrl+c on windows (#27269)

We don't need to forward the kill signal because ctrl+c events are sent
to the process group.

Closes https://github.com/denoland/deno/issues/27266
This commit is contained in:
David Sherret 2024-12-09 11:01:57 -05:00 committed by GitHub
parent 9fe52b1e8d
commit 56035f34a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -585,9 +585,15 @@ pub async fn run_future_forwarding_signals<TOutput>(
async fn listen_ctrl_c(kill_signal: KillSignal) {
while let Ok(()) = tokio::signal::ctrl_c().await {
// On windows, ctrl+c is sent to the process group, so the signal would
// have already been sent to the child process. We still want to listen
// for ctrl+c here to keep the process alive when receiving it, but no
// need to forward the signal because it's already been sent.
if !cfg!(windows) {
kill_signal.send(deno_task_shell::SignalKind::SIGINT)
}
}
}
#[cfg(unix)]
async fn listen_and_forward_all_signals(kill_signal: KillSignal) {