Skip to content

Commit

Permalink
Actual fix for Windows path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cknitt committed Jun 16, 2024
1 parent 82d5195 commit 5852e5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
macos-14, # ARM
ubuntu-latest, # x64
buildjet-2vcpu-ubuntu-2204-arm, # ARM
# windows-latest, # deactivated for now as there is still a Windows issue
windows-latest,
]

runs-on: ${{matrix.os}}
Expand Down
9 changes: 8 additions & 1 deletion src/RescriptVersions.res
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ let promptVersions = async () => {
let installVersions = async ({rescriptVersion, rescriptCoreVersion}) => {
let packageManager = PackageManagers.getActivePackageManager()
let packages = [`rescript@${rescriptVersion}`, `@rescript/core@${rescriptCoreVersion}`]
let command = `${packageManager} add ${packages->Array.join(" ")}`

// #58: Windows: packageManager may be something like
// "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js".
//
// Therefore, packageManager needs to be in quotes, and we need to prepend "node "
// if packageManager points to a JS file, otherwise the invocation will hang.
let maybeNode = packageManager->String.endsWith("js") ? "node " : ""
let command = `${maybeNode}"${packageManager}" add ${packages->Array.join(" ")}`

let _ = await Node.Promisified.ChildProcess.exec(command)
}
Expand Down

0 comments on commit 5852e5b

Please sign in to comment.