mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix: don't warn on ignored signals on windows (#26332)
Closes #26183. The warnings are super noisy and not actionable for the user
This commit is contained in:
parent
458d6278d2
commit
167f674c7c
2 changed files with 1 additions and 31 deletions
|
@ -520,9 +520,7 @@ Process.prototype.on = function (
|
||||||
} else if (
|
} else if (
|
||||||
event !== "SIGBREAK" && event !== "SIGINT" && Deno.build.os === "windows"
|
event !== "SIGBREAK" && event !== "SIGINT" && Deno.build.os === "windows"
|
||||||
) {
|
) {
|
||||||
// Ignores all signals except SIGBREAK and SIGINT on windows.
|
// TODO(#26331): Ignores all signals except SIGBREAK and SIGINT on windows.
|
||||||
// deno-lint-ignore no-console
|
|
||||||
console.warn(`Ignoring signal "${event}" on Windows`);
|
|
||||||
} else {
|
} else {
|
||||||
EventEmitter.prototype.on.call(this, event, listener);
|
EventEmitter.prototype.on.call(this, event, listener);
|
||||||
Deno.addSignalListener(event as Deno.Signal, listener);
|
Deno.addSignalListener(event as Deno.Signal, listener);
|
||||||
|
|
|
@ -25,7 +25,6 @@ import {
|
||||||
assertThrows,
|
assertThrows,
|
||||||
fail,
|
fail,
|
||||||
} from "@std/assert";
|
} from "@std/assert";
|
||||||
import { assertSpyCall, assertSpyCalls, spy } from "@std/testing/mock";
|
|
||||||
import { stripAnsiCode } from "@std/fmt/colors";
|
import { stripAnsiCode } from "@std/fmt/colors";
|
||||||
import * as path from "@std/path";
|
import * as path from "@std/path";
|
||||||
import { delay } from "@std/async/delay";
|
import { delay } from "@std/async/delay";
|
||||||
|
@ -239,33 +238,6 @@ Deno.test({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({
|
|
||||||
name: "process.on - ignored signals on windows",
|
|
||||||
ignore: Deno.build.os !== "windows",
|
|
||||||
fn() {
|
|
||||||
const ignoredSignals = ["SIGHUP", "SIGUSR1", "SIGUSR2"];
|
|
||||||
|
|
||||||
for (const signal of ignoredSignals) {
|
|
||||||
using consoleSpy = spy(console, "warn");
|
|
||||||
const handler = () => {};
|
|
||||||
process.on(signal, handler);
|
|
||||||
process.off(signal, handler);
|
|
||||||
assertSpyCall(consoleSpy, 0, {
|
|
||||||
args: [`Ignoring signal "${signal}" on Windows`],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
using consoleSpy = spy(console, "warn");
|
|
||||||
const handler = () => {};
|
|
||||||
process.on("SIGTERM", handler);
|
|
||||||
process.off("SIGTERM", handler);
|
|
||||||
// No warning is made for SIGTERM
|
|
||||||
assertSpyCalls(consoleSpy, 0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function processKill() {
|
async function processKill() {
|
||||||
|
|
Loading…
Reference in a new issue