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)
Description
On Windows,
run_shell_commandincorrectly 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:
testActual behavior:
The CLI strips the double quotes around
test, so Node receivesconsole.log(test)instead ofconsole.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
-EncodedCommandfor 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