Problem
On Windows, TtyCommandRunner::run_where takes the first line returned by where.exe and passes it directly to portable_pty. The first match can be an extensionless POSIX npm shim rather than a Win32 executable, which fails with CreateProcessW error 193.
This is reproducible when where.exe cmd finds an npm package named cmd before %SystemRoot%\\System32\\cmd.exe. The focused test cli::tty_runner::tests::test_run_sends_script_through_pty currently fails in that environment.
Where
rust/src/cli/tty_runner.rs
Expected behavior
- Inspect all
where.exe candidates rather than blindly taking the first line.
- Prefer launchable Windows candidates (
.exe, .com, and explicitly supported .cmd/.bat handling).
- Skip directories and extensionless POSIX npm shims.
- Validate environment overrides and explicit paths with the same rules.
- Make the integration test invoke
%ComSpec% instead of relying on a bare cmd lookup.
Tests
Add deterministic candidate-selection tests covering an extensionless shim before a valid executable.
Problem
On Windows,
TtyCommandRunner::run_wheretakes the first line returned bywhere.exeand passes it directly toportable_pty. The first match can be an extensionless POSIX npm shim rather than a Win32 executable, which fails withCreateProcessWerror 193.This is reproducible when
where.exe cmdfinds an npm package namedcmdbefore%SystemRoot%\\System32\\cmd.exe. The focused testcli::tty_runner::tests::test_run_sends_script_through_ptycurrently fails in that environment.Where
rust/src/cli/tty_runner.rsExpected behavior
where.execandidates rather than blindly taking the first line..exe,.com, and explicitly supported.cmd/.bathandling).%ComSpec%instead of relying on a barecmdlookup.Tests
Add deterministic candidate-selection tests covering an extensionless shim before a valid executable.