fix: support running sh shim from wsl#178
Conversation
|
hey @owlstronaut can you help with the failing CodeQL CI? Not sure what I can do on my end |
owlstronaut
left a comment
There was a problem hiding this comment.
Thanks for the PR! I don't know that this will work for us in all cases. As-is, the new basedir_win rewrite kicks in for any Linux host with wslpath on PATH and then unconditionally hands a windows-form path to whatever interpreter runs. That works for your node.exe+shim case you are targeting, but breaks the common WSL cases where the selected interpreter is a POSIX binary.
|
I don't think there's an issue with assuming the interpreter isn't POSIX if we're using cmd-shim. If the interpreter were POSIX, all shims created here would already break when invoked from intended shells (cmd, pwsh, cygwin, msys) since they currently pass Windows-form paths to the interpreter. On WSL with POSIX interpreters, users shouldn't be using cmd-shim in the first place, the README explicitly recommends symlinks instead.
I used npm/cli's approach for WSL detection, but I can narrow it down using |
|
Fair point on the posix interpreter concern. But yes, I think it can be narrowed to WSL2 with |
|
For the wslpath guard, I'm exiting with an error if wslpath fails since a unix fallback path won't work in WSL anyway. I also added a 4th path check for |
🤖 I have created a release *beep* *boop* --- ## [9.0.1](v9.0.0...v9.0.1) (2026-06-08) ### Bug Fixes * [`1ca32a3`](1ca32a3) [#178](#178) support running sh shim from wsl (#178) (@nadalaba) ### Chores * [`30cad4d`](30cad4d) [#183](#183) bump @npmcli/eslint-config from 6.0.1 to 7.0.0 (@dependabot[bot]) * [`3b7e7dc`](3b7e7dc) [#182](#182) postinstall for dependabot template-oss PR (@npm-cli-bot) * [`c64c525`](c64c525) [#182](#182) bump @npmcli/template-oss from 5.0.0 to 5.1.0 (@dependabot[bot]) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
What:
Support running sh shim from WSL.
Details:
.exewhich works from msys/cygwin shells but not from wsl. Also, the the target passed to the windows binary prog as a parameter had a unix path on WSL..exe. We also usewslpathto convert parameter's path to a Windows path.