Skip to content

Choose a launchable Windows executable in the PTY resolver #270

Description

@tsouth89

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersrustPull requests that update rust code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions