1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(child_process): map node --no-warnings flag to --quiet (#26288)

Closes https://github.com/denoland/deno/issues/25899
This commit is contained in:
Nathan Whitaker 2024-10-16 11:25:25 -07:00 committed by GitHub
parent 4385020d14
commit f7dba52133
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 2 deletions

View file

@ -132,6 +132,8 @@ export function fork(
rm = 2; rm = 2;
} }
execArgv.splice(index, rm); execArgv.splice(index, rm);
} else if (flag.startsWith("--no-warnings")) {
execArgv[index] = "--quiet";
} else { } else {
index++; index++;
} }

View file

@ -1191,8 +1191,12 @@ function toDenoArgs(args: string[]): string[] {
} }
if (flagInfo === undefined) { if (flagInfo === undefined) {
// Not a known flag that expects a value. Just copy it to the output. if (arg === "--no-warnings") {
denoArgs.push(arg); denoArgs.push("--quiet");
} else {
// Not a known flag that expects a value. Just copy it to the output.
denoArgs.push(arg);
}
continue; continue;
} }

View file

@ -1045,3 +1045,19 @@ Deno.test(async function sendAfterClosedThrows() {
await timeout.promise; await timeout.promise;
}); });
Deno.test(async function noWarningsFlag() {
const code = ``;
const file = await Deno.makeTempFile();
await Deno.writeTextFile(file, code);
const timeout = withTimeout<void>();
const child = CP.fork(file, [], {
execArgv: ["--no-warnings"],
stdio: ["inherit", "inherit", "inherit", "ipc"],
});
child.on("close", () => {
timeout.resolve();
});
await timeout.promise;
});