Skip to content

fix(win32): runner.cmd wrapped in double quotes to prevent spawn err#48289

Open
stoppieboy wants to merge 6 commits intoopenclaw:mainfrom
stoppieboy:fix/win32-path-err-spawn
Open

fix(win32): runner.cmd wrapped in double quotes to prevent spawn err#48289
stoppieboy wants to merge 6 commits intoopenclaw:mainfrom
stoppieboy:fix/win32-path-err-spawn

Conversation

@stoppieboy
Copy link
Copy Markdown

Fixes #45275

Problem
runner.cmd which contained spaces in the path was being passed as is to the spawn function. node documentation states that paths with spaces must be wrapped with quotes before being passed to the spawn function.

Solution
wrapped the path in double quotes for windows platform.

Change type: bug fix

Fixes openclaw#45275

**Problem**
runner.cmd which contained spaces in the path was being passed as is to the spawn function. node documentation states that paths with spaces must be wrapped with quotes before being passed to the spawn function.

**Solution**
wrapped the path in double quotes for windows platform.
@openclaw-barnacle openclaw-barnacle bot added scripts Repository scripts size: XS labels Mar 16, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 16, 2026

Greptile Summary

This PR fixes a Windows-specific spawn error that occurred when pnpm.cmd (or any .cmd/.bat/.com runner) was resolved to a path containing spaces. The fix quotes the command path in double quotes before passing it to spawn/spawnSync, but only when shouldUseShellForCommand returns true — i.e., only when shell: true will also be set by createSpawnOptions.

Key observations:

  • The conditional shouldUseShellForCommand(cmd) ? \"${cmd}"` : cmdis correctly aligned: quoting is applied if and only ifshell: trueis also active (both code paths use the same helper with the same argument), so.exeexecutables resolved bywhich()` are never accidentally quoted.
  • The original (unquoted) cmd is still passed to createSpawnOptions, which is correct — passing a pre-quoted string would cause path.extname to return an empty string and silently drop the shell: true flag.
  • On Windows with shell: true, Node.js constructs cmd.exe /d /s /c "<full_command>" using windowsVerbatimArguments, resulting in cmd.exe /c ""C:\path with spaces\pnpm.cmd" install" — which is the correct form for cmd.exe to handle a space-bearing path.
  • Previous review thread concerns (unconditional quoting, redundant platform check) have both been addressed in this iteration.

Confidence Score: 5/5

  • This PR is safe to merge — the fix is minimal, well-scoped, and correctly aligned with the existing shell-detection logic.
  • The quoting is conditional on shouldUseShellForCommand, the same predicate used to set shell: true, so .exe executables are never affected. The original cmd is passed to createSpawnOptions to preserve correct option generation. All concerns from previous review threads have been addressed. No new logic paths or security surface is introduced.
  • No files require special attention.

Last reviewed commit: e6cbe1a

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f21d4dc5e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@stoppieboy
Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@stoppieboy
Copy link
Copy Markdown
Author

@greptile review

@stoppieboy
Copy link
Copy Markdown
Author

@greptile review

@stoppieboy
Copy link
Copy Markdown
Author

@codex review

@stoppieboy
Copy link
Copy Markdown
Author

stoppieboy commented Mar 19, 2026

@steipete @vincentkoc review and merge ?

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

Labels

scripts Repository scripts size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Run "pnpm ui:build" noticed Couldn't find 'C:\Program' at windows.

1 participant