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;
}
execArgv.splice(index, rm);
} else if (flag.startsWith("--no-warnings")) {
execArgv[index] = "--quiet";
} else {
index++;
}

View File

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

View File

@ -1045,3 +1045,19 @@ Deno.test(async function sendAfterClosedThrows() {
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;
});