From ee438b636b54af71f57da1ddbeff6e8501c9ad72 Mon Sep 17 00:00:00 2001 From: EdamAmex <121654029+EdamAme-x@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:14:48 +0000 Subject: [PATCH] fix(child_process): ignore node experimental option --experimental-* --- ext/node/polyfills/child_process.ts | 2 ++ ext/node/polyfills/internal/child_process.ts | 2 ++ tests/unit_node/child_process_test.ts | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/ext/node/polyfills/child_process.ts b/ext/node/polyfills/child_process.ts index eda718ff34..041a7b6c54 100644 --- a/ext/node/polyfills/child_process.ts +++ b/ext/node/polyfills/child_process.ts @@ -134,6 +134,8 @@ export function fork( execArgv.splice(index, rm); } else if (flag.startsWith("--no-warnings")) { execArgv[index] = "--quiet"; + } else if (flag.startsWith("--experimental")) { + // Do Nothing } else { index++; } diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 65d825fd25..2749e22964 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -1193,6 +1193,8 @@ function toDenoArgs(args: string[]): string[] { if (flagInfo === undefined) { if (arg === "--no-warnings") { denoArgs.push("--quiet"); + } else if (arg.startsWith("--experimental")) { + // Do Nothing } else { // Not a known flag that expects a value. Just copy it to the output. denoArgs.push(arg); diff --git a/tests/unit_node/child_process_test.ts b/tests/unit_node/child_process_test.ts index 0ea3c46cf0..0ebc4e27dd 100644 --- a/tests/unit_node/child_process_test.ts +++ b/tests/unit_node/child_process_test.ts @@ -1061,3 +1061,19 @@ Deno.test(async function noWarningsFlag() { await timeout.promise; }); + +Deno.test(async function experimentalFlag() { + const code = ``; + const file = await Deno.makeTempFile(); + await Deno.writeTextFile(file, code); + const timeout = withTimeout(); + const child = CP.fork(file, [], { + execArgv: ["--experimental-vm-modules"], + stdio: ["inherit", "inherit", "inherit", "ipc"], + }); + child.on("close", () => { + timeout.resolve(); + }); + + await timeout.promise; +});