Skip to content

Fix Windows shell execution with paths containing spaces#211

Merged
subsy merged 1 commit intomainfrom
claude/issue-206-OdF4S
Jan 23, 2026
Merged

Fix Windows shell execution with paths containing spaces#211
subsy merged 1 commit intomainfrom
claude/issue-206-OdF4S

Conversation

@subsy
Copy link
Copy Markdown
Owner

@subsy subsy commented Jan 23, 2026

Summary

Fixes issue #206 by properly quoting command paths containing spaces when executing with shell: true on Windows. When Node.js spawn() is used with shell: true on Windows, paths with spaces must be wrapped in double quotes to prevent cmd.exe from splitting them at the space character.

Changes

  • New utility function: Added quoteForWindowsShell() in src/plugins/agents/base.ts that intelligently quotes paths only when necessary (contains spaces and not already quoted)
  • Updated BaseAgentPlugin: Modified runVersion() and execute() methods to quote command paths on Windows before spawning
  • Updated all agent plugins: Applied quoting to version detection in:
    • ClaudeAgentPlugin
    • CodexAgentPlugin
    • GeminiAgentPlugin
    • KiroAgentPlugin
    • OpenCodeAgentPlugin
    • DroidAgentPlugin
  • Comprehensive tests: Added unit tests for quoteForWindowsShell() and integration tests verifying proper quoting behavior in version detection across multiple agent plugins

Implementation Details

  • The quoteForWindowsShell() function is a pure utility that:
    • Returns paths unchanged if they contain no spaces
    • Returns paths unchanged if already quoted
    • Wraps paths with spaces in double quotes
  • Quoting is only applied on Windows (platform() === 'win32') and only when shell: true is used
  • The solution is backward compatible and doesn't affect Unix/Linux behavior

On Windows, when agent binaries are located in paths containing spaces
(e.g., C:\Program Files\nodejs\opencode.cmd), cmd.exe splits the unquoted
path at the space character, causing "'C:\Program' is not recognized" errors.

Added quoteForWindowsShell() utility that wraps paths in double quotes when
they contain spaces, applied to all spawn() calls using shell: true on Windows:
- BaseAgentPlugin.execute() startProcess
- BaseAgentPlugin.detect() default implementation
- All agent runVersion() methods (claude, opencode, codex, gemini, kiro)
- DroidAgentPlugin custom execute override

Closes #206

https://claude.ai/code/session_01Y5dUsC9kGyyZn9zuvpXLNq
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
ralph-tui Ignored Ignored Jan 23, 2026 4:40pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 23, 2026

Warning

Rate limit exceeded

@subsy has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 77.27273% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.04%. Comparing base (fa7f3d3) to head (ff68ae5).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/agents/base.ts 90.00% 1 Missing ⚠️
src/plugins/agents/builtin/codex.ts 50.00% 1 Missing ⚠️
src/plugins/agents/builtin/gemini.ts 50.00% 1 Missing ⚠️
src/plugins/agents/builtin/kiro.ts 50.00% 1 Missing ⚠️
src/plugins/agents/droid/index.ts 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #211      +/-   ##
==========================================
+ Coverage   45.02%   45.04%   +0.01%     
==========================================
  Files          84       84              
  Lines       24403    24411       +8     
==========================================
+ Hits        10988    10995       +7     
- Misses      13415    13416       +1     
Files with missing lines Coverage Δ
src/plugins/agents/builtin/claude.ts 52.18% <100.00%> (ø)
src/plugins/agents/builtin/opencode.ts 73.05% <100.00%> (ø)
src/plugins/agents/base.ts 63.53% <90.00%> (+0.26%) ⬆️
src/plugins/agents/builtin/codex.ts 48.87% <50.00%> (ø)
src/plugins/agents/builtin/gemini.ts 46.52% <50.00%> (ø)
src/plugins/agents/builtin/kiro.ts 64.42% <50.00%> (ø)
src/plugins/agents/droid/index.ts 15.61% <50.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@subsy subsy merged commit d74e19d into main Jan 23, 2026
9 checks passed
@subsy subsy deleted the claude/issue-206-OdF4S branch January 23, 2026 16:41
sakaman pushed a commit to sakaman/ralph-tui that referenced this pull request Feb 15, 2026
Fix Windows shell execution with paths containing spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants