Skip to content

Handle Windows npx detection when npx.cmd is missing#3416

Open
jlowin wants to merge 1 commit intomainfrom
codex/fix-windows-npx-detection-issue
Open

Handle Windows npx detection when npx.cmd is missing#3416
jlowin wants to merge 1 commit intomainfrom
codex/fix-windows-npx-detection-issue

Conversation

@jlowin
Copy link
Member

@jlowin jlowin commented Mar 6, 2026

Motivation

  • On Windows, _get_npx_command() probed npx.cmd, npx.exe, and npx using subprocess.run(..., shell=False), but only caught subprocess.CalledProcessError, so a missing executable raised FileNotFoundError and aborted the probe early instead of falling back to the next candidate.

Description

  • Continue probing when the candidate binary is absent by catching FileNotFoundError in the same except block as CalledProcessError, and add a focused unit test test_get_npx_command_windows_cmd_missing that simulates FileNotFoundError for npx.cmd and verifies fallback to npx.exe.

Before/after (conceptual):
except subprocess.CalledProcessError: -> except (subprocess.CalledProcessError, FileNotFoundError):

Testing

  • Ran uv sync (succeeded), ran the full test suite uv run pytest -n auto (environment showed unrelated timeouts/integration failures outside this CLI change), and ran the focused CLI tests with uv run pytest tests/cli/test_cli.py -k npx_command which passed (6 passed); uv run prek run --all-files failed to init hooks due to external network access to a git dependency.

Codex Task

@marvin-context-protocol marvin-context-protocol bot added bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. cli Related to FastMCP CLI commands (run, dev, install) or CLI functionality. labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. cli Related to FastMCP CLI commands (run, dev, install) or CLI functionality. codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant