Skip to content

Commit a1e9d42

Browse files
committed
fix(benchmarks): resolve execFileAsync .cmd issue and drop dead exec import
On Windows, execFile does not use a shell and cannot resolve npm's .cmd wrappers (e.g. claude.cmd). checkInstalled() succeeded via execSync (which goes through cmd.exe) but runRawClaudeCode threw ENOENT, returning setup_failed on the very platform the previous commit targeted. Add shell: process.platform === 'win32' to the execFileAsync call so cmd.exe is used on Windows (resolves .cmd) while POSIX keeps shell: false (no injection risk, args are already an array). Also removes the dead exec / execAsync imports left over from the shell-interpolated execAsync refactor.
1 parent 7685414 commit a1e9d42

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

scripts/benchmark-comparators.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
import path from 'path';
1515
import { fileURLToPath } from 'url';
1616
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
17-
import { execSync, exec, execFile } from 'child_process';
17+
import { execSync, execFile } from 'child_process';
1818
import { parseArgs } from 'util';
1919
import { promisify } from 'util';
2020
import { withManagedStdioClientSession } from './lib/managed-mcp-session.mjs';
2121

22-
const execAsync = promisify(exec);
2322
const execFileAsync = promisify(execFile);
2423

2524
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -413,7 +412,7 @@ async function runRawClaudeCode(rootPath, tasks) {
413412
const { stdout } = await execFileAsync(
414413
'claude',
415414
['-p', prompt, '--output-format', 'json', '--allowedTools', 'Read,Grep,Glob'],
416-
{ timeout: 120000, cwd: path.resolve(rootPath) }
415+
{ timeout: 120000, cwd: path.resolve(rootPath), shell: process.platform === 'win32' }
417416
);
418417
try {
419418
const parsed = JSON.parse(stdout);

0 commit comments

Comments
 (0)