summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-10-16 11:25:25 -0700
committerGitHub <noreply@github.com>2024-10-16 18:25:25 +0000
commitf7dba52133904a9e4ca0468e2c98894992ea2e42 (patch)
treed6767e6786173a1ba5c6013c8b8cc69450e47ca0
parent4385020d14cc1f2523cadec7e19011845edd8393 (diff)
fix(child_process): map node `--no-warnings` flag to `--quiet` (#26288)
Closes https://github.com/denoland/deno/issues/25899
-rw-r--r--ext/node/polyfills/child_process.ts2
-rw-r--r--ext/node/polyfills/internal/child_process.ts8
-rw-r--r--tests/unit_node/child_process_test.ts16
3 files changed, 24 insertions, 2 deletions
diff --git a/ext/node/polyfills/child_process.ts b/ext/node/polyfills/child_process.ts
index c37dfc410..eda718ff3 100644
--- a/ext/node/polyfills/child_process.ts
+++ b/ext/node/polyfills/child_process.ts
@@ -132,6 +132,8 @@ export function fork(
rm = 2;
}
execArgv.splice(index, rm);
+ } else if (flag.startsWith("--no-warnings")) {
+ execArgv[index] = "--quiet";
} else {
index++;
}
diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts
index 6f209b719..65d825fd2 100644
--- a/ext/node/polyfills/internal/child_process.ts
+++ b/ext/node/polyfills/internal/child_process.ts
@@ -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;
}
diff --git a/tests/unit_node/child_process_test.ts b/tests/unit_node/child_process_test.ts
index f776fa4ac..0ea3c46cf 100644
--- a/tests/unit_node/child_process_test.ts
+++ b/tests/unit_node/child_process_test.ts
@@ -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;
+});