Skip to content

Commit

Permalink
fix(ext/node): strip --enable-source-maps from argv (#22743)
Browse files Browse the repository at this point in the history
Fixes #21750
  • Loading branch information
littledivy authored Mar 6, 2024
1 parent 01bc2f5 commit 7542d10
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/node/polyfills/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ export function fork(
if (flag.startsWith("--max-old-space-size")) {
execArgv.splice(index, 1);
v8Flags.push(flag);
} else if (flag.startsWith("--enable-source-maps")) {
// https://github.com/denoland/deno/issues/21750
execArgv.splice(index, 1);
}
}
}

const stringifiedV8Flags: string[] = [];
if (v8Flags.length > 0) {
stringifiedV8Flags.push("--v8-flags=" + v8Flags.join(","));
Expand Down
27 changes: 27 additions & 0 deletions tests/unit_node/child_process_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,33 @@ Deno.test(async function forkIpcKillDoesNotHang() {
await p.promise;
});

Deno.test(async function stripForkEnableSourceMaps() {
const testdataDir = path.join(
path.dirname(path.fromFileUrl(import.meta.url)),
"testdata",
);
const script = path.join(
testdataDir,
"node_modules",
"foo",
"check_argv.js",
);
const p = Promise.withResolvers<void>();
const cp = CP.fork(script, [], {
cwd: testdataDir,
stdio: "pipe",
execArgv: ["--enable-source-maps"],
});
let output = "";
cp.on("close", () => p.resolve());
cp.stdout?.on("data", (data) => {
output += data;
cp.kill();
});
await p.promise;
assertEquals(output, "2\n");
});

Deno.test(async function execFileWithUndefinedTimeout() {
const { promise, resolve, reject } = Promise.withResolvers<void>();
CP.execFile(
Expand Down
1 change: 1 addition & 0 deletions tests/unit_node/testdata/node_modules/foo/check_argv.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7542d10

Please sign in to comment.