Skip to content

Commit

Permalink
MSYS support on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ManasJayanth committed Jun 8, 2024
1 parent 53a5ab7 commit 1846731
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ Needs Powershell 7
## Development

(Currently Windows only) Set `NODE_ENV` to `development` to enable sourcemaps at the node wrapper. Not useful inside the JS realm.

You'll need MSYS - Set $env:PATH to `$env:PATH = "C:\msys64\usr\bin;" + $env:PATH`. GitBash support is unreliable. MSYS is more reliable.
14 changes: 12 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ export async function cygpath(path: string) {
try {
platform = await uname();
} catch (e) {
platform = "Windows";
platform = "";
}

if (/cygwin/i.test(platform) || /mingw/i.test(platform)) {
// uname : GitBash from Terminal returns
// MINGW64_NT-10.0-xxx DESKTOP-xxx 3.4.10-xxx.x86_64 2024-02-14 20:17 UTC x86_64 Msys

// uname: from child_process.spawn
// MSYS_NT-10.0-xxx DESKTOP-xxx 3.4.10-xxx.x86_64 2024-02-14 20:17 UTC x86_64 Msys

if (
/msys/i.test(platform) ||
/cygwin/i.test(platform) ||
/mingw/i.test(platform)
) {
path = cp.execSync(`cygpath -u ${path}`).toString().trim();
}

Expand Down

0 comments on commit 1846731

Please sign in to comment.