Skip to content

Commit 5ad7f63

Browse files
fix(executor-e2e): invoke .js test fixture via process.execPath on Windows (#1616)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
1 parent 8fad0ab commit 5ad7f63

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

scripts/ado-script/src/executor-e2e/execute-cli.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,18 @@ export async function runExecute(opts: RunExecuteOptions): Promise<RunExecuteRes
171171
...opts.extraEnv,
172172
};
173173

174+
// On Windows, a .js file cannot be spawned directly (no OS-level shebang
175+
// support). When the configured binary is a Node script, invoke it through
176+
// the current Node executable instead so both Linux and Windows work
177+
// identically. The real ado-aw binary is always a native executable and is
178+
// never a .js file, so this branch is only exercised by test fixtures.
179+
const [spawnCmd, spawnArgs] =
180+
process.platform === "win32" && opts.adoAwBin.endsWith(".js")
181+
? [process.execPath, [opts.adoAwBin, ...args]]
182+
: [opts.adoAwBin, args];
183+
174184
opts.log(`[${opts.tool}] running: ${opts.adoAwBin} ${args.join(" ")}`);
175-
const { exitCode, stdout, stderr } = await spawnCollect(opts.adoAwBin, args, env);
185+
const { exitCode, stdout, stderr } = await spawnCollect(spawnCmd, spawnArgs, env);
176186
if (stdout.trim()) opts.log(`[${opts.tool}] stdout:\n${stdout.trim()}`);
177187
if (stderr.trim()) opts.log(`[${opts.tool}] stderr:\n${stderr.trim()}`);
178188

0 commit comments

Comments
 (0)