From f460188e583f00144000aa0d8ade08218d47c3c1 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 19 Sep 2024 12:22:01 +0900 Subject: fix(ext/node): don't throw error for unsupported signal binding on windows (#25699) --- ext/node/polyfills/process.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ext/node') diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index 82f92ebaf..3dc6ce61a 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -517,6 +517,12 @@ Process.prototype.on = function ( // Ignores SIGBREAK if the platform is not windows. } else if (event === "SIGTERM" && Deno.build.os === "windows") { // Ignores SIGTERM on windows. + } else if ( + event !== "SIGBREAK" && event !== "SIGINT" && Deno.build.os === "windows" + ) { + // Ignores all signals except SIGBREAK and SIGINT on windows. + // deno-lint-ignore no-console + console.warn(`Ignoring signal "${event}" on Windows`); } else { EventEmitter.prototype.on.call(this, event, listener); Deno.addSignalListener(event as Deno.Signal, listener); @@ -541,8 +547,10 @@ Process.prototype.off = function ( } else if (event.startsWith("SIG")) { if (event === "SIGBREAK" && Deno.build.os !== "windows") { // Ignores SIGBREAK if the platform is not windows. - } else if (event === "SIGTERM" && Deno.build.os === "windows") { - // Ignores SIGTERM on windows. + } else if ( + event !== "SIGBREAK" && event !== "SIGINT" && Deno.build.os === "windows" + ) { + // Ignores all signals except SIGBREAK and SIGINT on windows. } else { EventEmitter.prototype.off.call(this, event, listener); Deno.removeSignalListener(event as Deno.Signal, listener); -- cgit v1.2.3