From df1bd118959edc956575156dee55fc45b2b8b93b Mon Sep 17 00:00:00 2001 From: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> Date: Sat, 21 Nov 2026 17:55:13 +0100 Subject: [PATCH] test(process): publish timeout stop signal atomically in ExecFileOutput test (#13151) The child recorded the received signal with writeFileSync, which creates an empty file before writing. The test polls for existence and reads the content while the child is still alive, so it could observe '' instead of SIGINT (main CI run 44898480483). Write to a sibling file and rename it. Co-authored-by: gensokyo-dev Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --- src/process/ExecFileOutput.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/process/ExecFileOutput.test.ts b/src/process/ExecFileOutput.test.ts index 71ac078512..44b7f97c1a 100644 --- a/src/process/ExecFileOutput.test.ts +++ b/src/process/ExecFileOutput.test.ts @@ -352,10 +352,13 @@ describe.skipIf(process.platform === "win32")( const ready = join(directory, "ready"); const stopped = join(directory, "stopped"); const release = join(directory, "release"); + // Publish the signal by rename so the poller never reads a created but + // still-empty file while the child is alive. const script = [ 'const fs = require("node:fs");', 'for (const name of ["SIGINT", "SIGTERM"]) process.on(name, () => {', - ` fs.writeFileSync(${JSON.stringify(stopped)}, name);`, + ` fs.writeFileSync(${JSON.stringify(`${stopped}.partial`)}, name);`, + ` fs.renameSync(${JSON.stringify(`${stopped}.partial`)}, ${JSON.stringify(stopped)});`, ` const exitCode = ${JSON.stringify(exitCode)};`, " if (exitCode !== null) process.exit(exitCode);", "});",