Skip to content

fix(windows): resolve platform shell instead of hardcoding /bin/sh#22

Open
arosstale wants to merge 1 commit intoopenclaw:mainfrom
arosstale:fix/windows-shell-resolution
Open

fix(windows): resolve platform shell instead of hardcoding /bin/sh#22
arosstale wants to merge 1 commit intoopenclaw:mainfrom
arosstale:fix/windows-shell-resolution

Conversation

@arosstale
Copy link

Summary

All shell execution paths hardcode /bin/sh which doesn't exist on Windows, causing spawn ENOENT on every shell command.

What broke

On Windows, any command using --shell, SDK exec() with shell:true, or workflow file steps throws:

Error: spawn /bin/sh ENOENT

How the fix works

Added src/shell.ts with a resolveShell(command) helper that returns:

  • ['cmd.exe', ['/s', '/c', command]] on win32
  • ['/bin/sh', ['-lc', command]] elsewhere

Updated 3 call sites:

  • src/commands/stdlib/exec.ts
  • src/sdk/primitives/exec.ts
  • src/workflows/file.ts

Testing

  • Built and ran test suite on Windows 11
  • Shell resolution fix eliminates ENOENT errors
  • 6 pre-existing test failures remain (tests use Unix-specific commands like printf and single-quoted node -e)

[AI-assisted]

All exec paths hardcode /bin/sh which doesn't exist on Windows, causing
ENOENT on every shell command. This adds a resolveShell() helper that
returns cmd.exe on win32 and /bin/sh elsewhere.

Fixes spawn ENOENT on Windows for:
- exec --shell commands
- SDK exec() with shell:true
- Workflow file step execution
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.

1 participant