From c94bd27e85d1dab3a8dda64eb1fadaffa6a65fee Mon Sep 17 00:00:00 2001 From: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Date: Sat, 24 Oct 2026 23:57:23 +0800 Subject: [PATCH] fix(runner): scope internal Node notices to the supervisor (#7020) --- scripts/run-exclusive.mjs | 4 +++ .../process-global/runnerCancellation.test.ts | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/scripts/run-exclusive.mjs b/scripts/run-exclusive.mjs index be98597096..93b967078c 100644 --- a/scripts/run-exclusive.mjs +++ b/scripts/run-exclusive.mjs @@ -8,6 +8,10 @@ let shutdownSignal; const supervisor = spawn( process.execPath, [ + // SQLite and Windows source transforms are internal supervisor APIs. This + // process-only flag keeps their notices out of command stderr without + // changing the command's arguments, environment, or warning behavior. + "--disable-warning=ExperimentalWarning", fileURLToPath(new URL("./run-exclusive-command.mjs", import.meta.url)), ...process.argv.slice(2), ], diff --git a/tests/process-global/runnerCancellation.test.ts b/tests/process-global/runnerCancellation.test.ts index 2560f67870..ac58a8c080 100644 --- a/tests/process-global/runnerCancellation.test.ts +++ b/tests/process-global/runnerCancellation.test.ts @@ -318,6 +318,33 @@ it("preserves executable arguments through the public runner", async () => { }); }); +it("preserves command stderr, warnings and exit status independently of supervisor notices", async () => { + const directory = await createTestTempDirectory("rea-runner-diagnostics-"); + const stderr = 'authored command stderr: \"quotes\" & 雪\n'; + const result = await execute(directory, process.execPath, [ + "-e", + ` +process.stdout.write(JSON.stringify({ + disabledWarnings: process.execArgv.filter((argument) => argument.startsWith("--disable-warning")), +})); +process.stderr.write(${JSON.stringify(stderr)}); +process.emitWarning("authored command experiment", { type: "ExperimentalWarning" }); +process.emitWarning("authored command deprecation", { type: "DeprecationWarning" }); +process.exitCode = 7; +`, + ]); + expect(result.code).toBe(7); + expect(JSON.parse(result.stdout)).toEqual({ disabledWarnings: [] }); + expect(result.stderr).toContain(stderr); + expect(result.stderr).toContain( + "ExperimentalWarning: authored command experiment", + ); + expect(result.stderr).toContain( + "DeprecationWarning: authored command deprecation", + ); + expect(result.stderr).not.toContain("stripTypeScriptTypes"); +}); + it.runIf(process.platform === "win32")( "launches an executable from a path containing spaces", async () => {