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

🙏🏻 [feat/req] Implement signal handlers for Windows #9995

Open
rivy opened this issue Apr 4, 2021 · 5 comments
Open

🙏🏻 [feat/req] Implement signal handlers for Windows #9995

rivy opened this issue Apr 4, 2021 · 5 comments
Labels
public API related to "Deno" namespace in JS suggestion suggestions for new features (yet to be agreed) windows Related to Windows platform

Comments

@rivy
Copy link
Contributor

rivy commented Apr 4, 2021

Currently, all the available signal handling API throw "unimplemented" errors for Windows platforms.

It would be great to have cross-platform signal handling along the lines of NodeJS Process Signal Events...

// ...works in NodeJS...

[`SIGBREAK`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `uncaughtException`, `SIGTERM`].forEach((eventType) => {
	process.on(eventType, catchSignal.bind(null, eventType));
});
[`exit`].forEach((eventType) => {
	process.on(eventType, catchExit.bind(null, eventType));
});

function catchSignal(eventType) {
	console.log('Caught signal...', { eventType });
}
function catchExit(eventType) {
	console.log('Now exiting...', { eventType });
}

setTimeout(() => {
	console.log('The service is now finished.');
}, 2000);
@kitsonk kitsonk added public API related to "Deno" namespace in JS suggestion suggestions for new features (yet to be agreed) windows Related to Windows platform labels Apr 4, 2021
@rivy
Copy link
Contributor Author

rivy commented Sep 12, 2021

There is a stalled partial implementation (Windows CTRL-C/CTRL-BREAK (SIGINT/SIGBREAK) signal handler).

related

@rivy rivy mentioned this issue Nov 9, 2021
@rivy
Copy link
Contributor Author

rivy commented Jun 12, 2022

😃
Yeah! There's some revived signal handling work going on in #14694.

@swiftsword94
Copy link

When testing with a generated prisma client(without windows) it seems like the following signals break on windows when adding the signal listeners: SIGUSR2, SIGINT, SIGTERM, beforeExit, exit.

this is when using createrequire via "node:module" and importing the generated client

Uncaught TypeError: Windows only supports ctrl-c (SIGINT) and ctrl-break (SIGBREAK).
    at bindSignal (ext:runtime/40_signals.js:16:14)
    at Object.addSignalListener (ext:runtime/40_signals.js:56:19)
    at process.on (ext:deno_node/process.ts:293:22)
    at process.once (ext:deno_node/_events.mjs:525:8)

Should similar functionality to nodejs be made for these signals?

@BlackGlory
Copy link

BlackGlory commented Jan 8, 2024

I encountered this error on deno 1.39.1.

import puppeteer from 'npm:[email protected]'

await puppeteer.launch({
  executablePath: 'chrome'
})
error: Uncaught (in promise) TypeError: Windows only supports ctrl-c (SIGINT) and ctrl-break (SIGBREAK).

This works:

import puppeteer from 'npm:[email protected]'

await puppeteer.launch({
  executablePath: 'chrome'
, handleSIGHUP: false
, handleSIGTERM: false
})

@guillaume86
Copy link

The handleSIGTERM: false is not required, only handleSIGHUP ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
public API related to "Deno" namespace in JS suggestion suggestions for new features (yet to be agreed) windows Related to Windows platform
Projects
None yet
Development

No branches or pull requests

5 participants