Summary
I was able to reproduce this error locally. The output looks like:
-- Running eslint-bulk-suppressions for [email protected] in client --
STDOUT:
STDERR:
@rushstack/eslint-bulk: Error finding patch path: Command failed: C:\Program Files\nodejs\node.exe C:/Git/rushstack/common/temp/default/node_modules/.pnpm/[email protected]/node_modules/eslint/./bin/eslint.js --stdin --config C:\Git\rushstack\build-tests\eslint-bulk-suppressions-test\client/.eslintrc.js
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
------------------------------------------------------------------
It looks like a regression caused by PR ##4627
Details
The problem is that this code is pasting strings together without proper escaping:
|
let eslintBinCommand: string; |
|
if (eslintBinPath) { |
|
eslintBinCommand = `${process.argv0} ${eslintBinPath}`; |
|
} else { |
|
eslintBinCommand = 'eslint'; // Try to use a globally-installed eslint if a local package was not found |
|
} |
|
|
|
let stdout: Buffer; |
|
try { |
|
stdout = execSync(`${eslintBinCommand} --stdin --config ${eslintrcPath}`, { |
|
env, |
|
input: '', |
|
stdio: 'pipe' |
|
}); |
On Windows, the eslintBinCommand string has this value: "C:\\Program Files\\nodejs\\node.exe C:/Git/rushstack/common/temp/default/node_modules/.pnpm/[email protected]/node_modules/eslint/./bin/eslint.js".
@iclanton I'm not sure this is even solvable using execSync(). The best known solution is Executable.spawnSync() (which still acknowledges that certain characters are impossible to escape on Windows). But avoiding that dependency, we should at least use spawnSync() instead of execSync() here.
Summary
I was able to reproduce this error locally. The output looks like:
It looks like a regression caused by PR ##4627
Details
The problem is that this code is pasting strings together without proper escaping:
rushstack/eslint/eslint-bulk/src/start.ts
Lines 69 to 82 in fb711c1
On Windows, the
eslintBinCommandstring has this value:"C:\\Program Files\\nodejs\\node.exe C:/Git/rushstack/common/temp/default/node_modules/.pnpm/[email protected]/node_modules/eslint/./bin/eslint.js".@iclanton I'm not sure this is even solvable using
execSync(). The best known solution isExecutable.spawnSync()(which still acknowledges that certain characters are impossible to escape on Windows). But avoiding that dependency, we should at least usespawnSync()instead ofexecSync()here.