Skip to content

Windows: terminal commands fail with ENOENT because buildTerminalSpawnOptions lacks shell:true #169

@qwexs

Description

@qwexs

Problem

On Windows, all terminal commands spawned via createTerminal (ACP protocol) fail with spawn ENOENT, even when the command exists in PATH.

This affects every command: git,
ode, where, cmd, etc.

Root Cause

�uildTerminalSpawnOptions() in session-*.js does not set shell: true. On Windows, Node.js child_process.spawn() without shell: true does not use cmd.exe to resolve commands from PATH — it tries to find the executable directly, which fails for commands that rely on PATH resolution or PATHEXT.

On Linux/macOS this works because the OS kernel handles PATH resolution during �xecve(). Windows does not.

Current Code

function buildTerminalSpawnOptions(cwd, env) {
    return {
        cwd,
        env: toEnvObject(env),
        stdio: ["ignore", "pipe", "pipe"],
        windowsHide: true
    };
}

Fix

function buildTerminalSpawnOptions(cwd, env) {
    return {
        cwd,
        env: toEnvObject(env),
        stdio: ["ignore", "pipe", "pipe"],
        shell: process.platform === "win32",
        windowsHide: true
    };
}

Reproduction

  1. Run acpx on Windows with any ACP agent (claude-code-acp, codex, etc.)
  2. Agent tries to execute any terminal command (e.g. git --version)
  3. Error: spawn git --version ENOENT

Environment

  • Windows 11
  • Node.js v24.13.0
  • acpx 0.3.0
  • Git installed at C:\Program Files\Git\cmd\git.exe (in PATH)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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