Skip to content

fix: enable shell for terminal spawn on Windows#173

Open
Bortlesboat wants to merge 1 commit intoopenclaw:mainfrom
Bortlesboat:fix-windows-terminal-shell
Open

fix: enable shell for terminal spawn on Windows#173
Bortlesboat wants to merge 1 commit intoopenclaw:mainfrom
Bortlesboat:fix-windows-terminal-shell

Conversation

@Bortlesboat
Copy link
Contributor

Summary

  • Add shell: process.platform === "win32" to buildTerminalSpawnOptions() so terminal commands resolve from PATH on Windows
  • On Windows, child_process.spawn() without shell: true doesn't use cmd.exe for PATH resolution, causing every terminal command to fail with ENOENT
  • Linux/macOS handle this in the kernel during execve(), so shell is only enabled on Windows

Test plan

  • Added test in spawn-options.test.ts verifying shell is always a boolean
  • All existing spawn-options tests pass
  • oxlint, oxfmt, and tsc --noEmit clean
  • Verified on Windows 11 — git, node, and other PATH commands now resolve correctly

Closes #169

On Windows, Node.js child_process.spawn() without shell:true does not
use cmd.exe to resolve commands from PATH. This causes every terminal
command to fail with ENOENT. Linux/macOS kernels handle PATH resolution
during execve(), so only Windows needs the shell flag.

Closes openclaw#169
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.

Windows: terminal commands fail with ENOENT because buildTerminalSpawnOptions lacks shell:true

1 participant