Skip to content
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

deno task - "SIGINT" (CTRL+C) doesn't work on Windows after upgrading to version 2.1.3 #27266

Closed
hchengting opened this issue Dec 7, 2024 · 2 comments · Fixed by #27269
Closed
Labels
bug Something isn't working correctly task runner related to deno task windows Related to Windows platform

Comments

@hchengting
Copy link

Version: Deno 2.1.3

// Works in 2.1.2 but not in 2.1.3
Deno.addSignalListener('SIGINT', () => {
    console.log('Received SIGINT');
});
@hchengting hchengting changed the title "SIGINT" (CTRL+C) doesn't work on Windows after updating to version 2.1.3 "SIGINT" (CTRL+C) doesn't work on Windows after upgrading to version 2.1.3 Dec 7, 2024
@dsherret
Copy link
Member

dsherret commented Dec 7, 2024

It works for me on Windows.

> deno -v
deno 2.1.3
> deno run main.ts
Received SIGINT
Received SIGINT
Received SIGINT
> cat main.ts      
Deno.addSignalListener('SIGINT', () => {
  console.log('Received SIGINT');
});

setInterval(() => {}, 1000);

@dsherret dsherret added the needs info needs further information to be properly triaged label Dec 7, 2024
@hchengting
Copy link
Author

The problem seems to be related to deno task.

{
  "tasks": {
    "main": "deno run main.ts"
  }
}
// main.ts
Deno.addSignalListener('SIGINT', () => {
    console.log('Received SIGINT');
    Deno.exit();
});

setInterval(() => {}, 1000);
deno run main.ts // OK
deno task main // Failed to receive SIGINT

@dsherret dsherret changed the title "SIGINT" (CTRL+C) doesn't work on Windows after upgrading to version 2.1.3 deno task - "SIGINT" (CTRL+C) doesn't work on Windows after upgrading to version 2.1.3 Dec 7, 2024
@dsherret dsherret added bug Something isn't working correctly windows Related to Windows platform task runner related to deno task and removed needs info needs further information to be properly triaged labels Dec 7, 2024
dsherret added a commit that referenced this issue Dec 9, 2024
We don't need to forward the kill signal because ctrl+c events are sent
to the process group.

Closes #27266
bartlomieju pushed a commit that referenced this issue Dec 11, 2024
We don't need to forward the kill signal because ctrl+c events are sent
to the process group.

Closes #27266
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly task runner related to deno task windows Related to Windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants