Fix: Use Bun Native Shell for Cross-Platform Windows Support #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Shell commands configured in hooks fail to execute on Windows with error:
This happens because the plugin uses
sh -c ${command}to execute commands, but Bun on Windows doesn't haveshin PATH.Solution
Use Bun's native cross-platform shell with the
${{ raw: command }}syntax. Bun Shell is a Zig-based interpreter that works natively on Windows, Linux, and macOS without requiring/bin/sh.Changes
src/execution/shell.ts: Replacesh -c ${command}with${{ raw: command }}tests/execution.shell.test.ts: Update 4 tests to use cross-platform shell syntax:printf 'error' 1>&2instead ofsh -c 'echo >&2'VAR=val && echo $VARinstead ofsh -cprintf 'error' 1>&2instead ofecho 'error' >&2(invalidinstead ofsh -c 'invalid'Testing
exitCode=0and captured outputprintf, env var assignment, redirection) are Bun shell builtins that should work identically on all platforms. CI would catch any platform-specific issues.Known Limitations
During testing, discovered that Bun shell's built-in
echodoesn't properly support fd redirection (>&2), butprintfdoes. This is a Bun shell limitation, not specific to this plugin. Users needing to redirect echo output to stderr should useprintfinstead.