Skip to content

Windows: Regression - run_shell_command strips double quotes #25859

Description

@kaluchi

Description

On Windows, run_shell_command incorrectly strips double quotes from commands, even when they are properly enclosed in single quotes or escaped. This breaks any tool that requires quoted arguments (Node.js, JDT, JSON parsers).

Steps to Reproduce

Run the following command via Gemini CLI on Windows:
!node -e 'console.log("test")'

Expected behavior:
Output: test

Actual behavior:

ReferenceError: test is not defined
    at [eval]:1:13

The CLI strips the double quotes around test, so Node receives console.log(test) instead of console.log("test").

Technical Root Cause

The issue is caused by wrapping commands in powershell.exe -NoProfile -Command "...".
When the outer wrapper is a double-quoted string, internal double quotes are lost or mangled during the process spawn on Windows.

Suggested Fix

Use -EncodedCommand for Windows shell execution.
Encoding the command string as Base64 (UTF-16LE) is the only reliable way to ensure that complex strings and quotes are preserved exactly as intended by the model.

Environment

  • OS: Windows 10/11
  • Gemini CLI Version: 0.39.0 (Latest Stable)

Metadata

Metadata

Assignees

Labels

area/platformIssues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmthelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!kind/bugpriority/p1Important and should be addressed in the near term.status/bot-triagedwindowsWindows OS related fix or improvement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions