Skip to content

[BUG] PowerShell cmdlets fail when Inline Terminal is ON — execa uses cmd.exe instead of user shell #705

Closed

Description

@myk1yt

A Note from the User

This is a message from me, a human user. I asked AI to handle the rest of the issue report.

I tried to patch the problems I encountered while using Zoo Code myself. The patches may be incomplete or may not work correctly. Please, the bug fix team, judge them directly. I hope Zoo Code continues to grow and mature.


Problem

When "Use Inline Terminal (recommended)" setting is ON, PowerShell cmdlets like Test-Path, Get-ChildItem return 'Test-Path' is not recognized as an internal or external command. The inline terminal uses execa backend which defaults to cmd.exe on Windows, ignoring the user's shell preference.

Context

  • OS: Windows 11, PowerShell 5.1
  • Zoo Code Version: v3.63.100188
  • Model: mimo-v2.5-pro
  • Setting: "Use Inline Terminal (recommended)" = ON

Reproduction Steps

  1. Zoo Code Settings → Terminal → "Use Inline Terminal (recommended)" ON
  2. Execute Test-Path "README.md" via execute_command
  3. Runs in cmd.exe, PowerShell cmdlet fails

Expected Result

Test-Path "README.md" should return True.

Actual Result

'Test-Path' is not recognized as an internal or external command, operable program or batch file.

Root Cause

From Zoo Code documentation:

ON (Use Inline Terminal): Runs commands with the Inline Terminal (in chat), bypassing shell profiles and VS Code shell integration. Mechanism: uses a background "execa" provider and streams output directly.

When Inline Terminal is ON:

  1. Does NOT use VS Code's PowerShell terminal
  2. Creates background process via Node.js execa library
  3. execa uses cmd.exe by default on Windows

The jJe (execaTerminal) class in extension.js does not respect the user's shell settings when calling execa.

Applied Patch

We resolved this by turning off Inline Terminal and adding a PowerShell shellPath fallback in the Pn constructor (v6 patch):

// When getProfileShell() returns undefined in Pn constructor
let explicitShell = process.platform === "win32"
  ? (process.env.SystemRoot || "C:\\Windows") + "\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
  : (process.env.SHELL || "/bin/bash");
n.shellPath = explicitShell;

Recommended Official Fix

Option 1: Respect user shell settings in execa backend:

// In jJe (execaTerminal) class
const shellPath = process.platform === "win32"
  ? (Pn.getProfileShell()?.shellPath || process.env.ComSpec || "cmd.exe")
  : (process.env.SHELL || "/bin/bash");

Option 2: Add shell option for inline terminal in settings:

{
  "roo-cline.inlineTerminal.shell": "powershell"
}

Option 3: Change default to Inline Terminal OFF (currently ON by default)

Activity

  1. myk1yt commented on Jun 24, 2026

    @myk1yt
    ContributorAuthor

    [RESOLVED] Inline Terminal uses cmd.exe instead of PowerShell on Windows

    Problem

    When "Use Inline Terminal (recommended)" is ON, PowerShell cmdlets like Test-Path, Get-ChildItem fail with 'Test-Path' is not recognized as an internal or external command. The Inline Terminal uses the execa library which defaults to cmd.exe on Windows, ignoring the user's shell preference set in VS Code settings.

    Root Cause

    In extension.js at the execa call site (byte offset ~14,556,931), the shell resolution logic was:

    // BEFORE (broken)
    shell: sW.getExecaShellPath() || !0

    getExecaShellPath() returns undefined by default, so undefined || true tells execa to use the system default shell, which is ComSpec = cmd.exe on Windows. This bypasses VS Code's terminal.integrated.defaultProfile.windows setting entirely.

    Fix Applied

    Replaced the shell fallback with platform-aware logic using PATH-based resolution:

    // AFTER (fixed) — at offset 14,556,931 in extension.js
    shell: sW.getExecaShellPath() || (process.platform === "win32" ? "powershell.exe" : !0)

    This makes the Inline Terminal use PowerShell 5.1 on Windows (always available in system PATH at C:\Windows\System32\WindowsPowerShell\v1.0\). macOS/Linux behavior is unchanged (!0 = true = system default).

    Why PATH-based instead of absolute path

    powershell.exe is always in the Windows system PATH, so execa resolves it correctly without needing the full absolute path C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe. This is simpler and works on all Windows installations regardless of system drive letter.

    Verification

    • echo $PSVersionTable.PSVersion in Inline Terminal now outputs the PowerShell version number (previously printed as literal string in cmd.exe)
    • PowerShell cmdlets (Test-Path, Get-ChildItem, etc.) work correctly
    • Node.js --check syntax validation passed
    • macOS/Linux behavior unchanged

    Limitation

    This is a local patch to compiled extension.js. It will be overwritten on extension updates and needs re-application. A permanent fix would require adding a roo-cline.inlineTerminal.shell configuration option in the extension's package.json.

  2. DennisFederico commented on Aug 21, 2026

    @DennisFederico

    Strange as it may, after hours of doing different tests using both Rider and VSCode... I created a user variable for ComSpec pointing to powershell.exe, it seems that the underlying library uses %COMSPEC% to run the command... that worked for me.

    Image

    That should not be the solution, but I cannot think of any process or tool in my system (nowadays) that would use cmd.exe... just In case I left the system default value intact

    Image

    This makes me think that in fact the underlying runner library or mechanism is somehow wrong, it should use the VSCode/Rider terminal "Id", as passed to the model/provider and not default configured in the OS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions