Skip to content

Commit

Permalink
fix(child_process): map node --no-warnings flag to --quiet (#26288)
Browse files Browse the repository at this point in the history
Closes #25899
  • Loading branch information
nathanwhit authored Oct 16, 2024
1 parent 4385020 commit f7dba52
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ext/node/polyfills/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export function fork(
rm = 2;
}
execArgv.splice(index, rm);
} else if (flag.startsWith("--no-warnings")) {
execArgv[index] = "--quiet";
} else {
index++;
}
Expand Down
8 changes: 6 additions & 2 deletions ext/node/polyfills/internal/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
16 changes: 16 additions & 0 deletions tests/unit_node/child_process_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

0 comments on commit f7dba52

Please sign in to comment.