fix(sh shim): support running Windows binaries from wsl#56
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📜 Recent review details🔇 Additional comments (11)
📝 WalkthroughWalkthroughcmd-shim now enhances POSIX shell shim generation to detect Windows and WSL environments via ChangesWindows and WSL path handling for POSIX shell shims
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix sh shim generation to run Windows binaries correctly under WSL WalkthroughsDescription• Detect WSL2 in generated shims and compute a Windows-style basedir for .exe execution. • Keep POSIX paths for non-.exe programs to support posix binaries in this fork. • Update shim snapshots to reflect new WSL/Cygwin path handling and exec fallbacks. Diagramgraph TD
A["generateShShim()"] --> B["Generated .sh shim"] --> C{"Detect environment"}
C -->|"CYGWIN/MINGW/MSYS"| D["cygpath -> basedir_win"]
C -->|"WSL2"| E["wslpath -> basedir_win"]
C -->|"Other"| F["basedir_win=basedir"]
B --> G{"Program is .exe?"}
G -->|"Yes"| H["Exec uses basedir_win + Win paths"]
G -->|"No"| I["Exec uses basedir + POSIX paths"]
subgraph Legend
direction LR
_p["Process"] ~~~ _d{"Decision"}
end
High-Level AssessmentThe following are alternative approaches to this PR: 1. Detect WSL via env vars (/proc/version, WSL_INTEROP)
2. Always normalize basedir to Windows path when wslpath exists
Recommendation: Keep the PR’s approach: compute both File ChangesBug fix (1)
Tests (2)
|
- Port the shell shim behavior from pnpm/cmd-shim#56 to pacquet. - Generate `basedir_win` with Cygwin/MSYS/WSL2 handling and use it only when invoking `.exe` runtime branches. - Preserve POSIX target paths for non-`.exe` runtime branches and add the `.cmd`/`.bat` `/C` runtime fallback. - Gate MSYS-specific cmd switch escaping behind an `$msys` runtime flag, so MSYS gets `//C` while WSL2 and other shells keep `/C`. - Bump `@zkochan/cmd-shim` to 9.0.6.
add the same changes as npm#178, but when the prog does not end with the Windows
.exeextension keep the passed parameter in its linux-form path, because on this fork, prog can be a posix binary.Summary by CodeRabbit
Release Notes