Skip to content

Windows: devcontainer CLI not detected when spawned without executable extension #3717

Description

@alecsg77

mux appears to fail detecting an installed devcontainer CLI on Windows.

At src/node/runtime/devcontainerCli.ts (around line 181), the code runs:

spawn("devcontainer", ["--version"], { ... })

Source: https://github.com/coder/mux/blob/main/src/node/runtime/devcontainerCli.ts#L181

On Windows, devcontainer is often resolved through extensions such as .bat/.cmd/.ps1. With plain child_process.spawn(...) (without shell resolution or a cross-platform wrapper), command lookup can fail even when devcontainer is installed and available in PATH.

Steps to reproduce

  1. Use Windows (PowerShell or CMD), with devcontainer CLI correctly installed and callable from terminal.
  2. Run mux in a flow that triggers the devcontainer version check.
  3. Observe that mux reports devcontainer as missing/unavailable.

Expected behavior

Mux should detect devcontainer successfully on Windows when the CLI is installed and in PATH.

Actual behavior

Detection fails because spawn("devcontainer", ...) does not reliably resolve the Windows command variant.

Environment

  • OS: Windows (10/11)
  • Repo: coder/mux
  • File: src/node/runtime/devcontainerCli.ts
  • Observed near: line 181
  • Commit referenced: 370cb3b97f5a173fc6c8ea88edcd0f1b16bf6e9f

Possible fix

Either of these approaches should make detection cross-platform-safe:

  1. Use spawn(..., { shell: true }) for this command check, or
  2. Replace direct spawn with a wrapper like cross-spawn, which handles Windows command resolution (PATHEXT, .cmd/.bat, etc.) more reliably.

Additional notes

Happy to test a patch on Windows if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions