Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion src/NewProject.res
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ let createProject = async (~templateName, ~projectName, ~versions) => {
await updateRescriptJson(~projectName, ~versions)

await RescriptVersions.installVersions(versions)
let _ = await Promisified.ChildProcess.execFile("git", ["init"])
let _ = await Promisified.ChildProcess.exec("git init")

if !CI.isRunningInCI {
s->P.Spinner.stop("Project created.")
Expand Down
10 changes: 9 additions & 1 deletion src/RescriptVersions.res
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ let installVersions = async ({rescriptVersion, rescriptCoreVersion}) => {
let packageManager = PackageManagers.getActivePackageManager()
let packages = [`rescript@${rescriptVersion}`, `@rescript/core@${rescriptCoreVersion}`]

let _ = await Node.Promisified.ChildProcess.execFile(packageManager, ["add", ...packages])
// #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)
}

let esmModuleSystemName = ({rescriptVersion}) =>
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/Node.res
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ module Promisified = {
type execResult = {stdout: string, stderr: string}

@module("./NodePromisified.mjs")
external execFile: (string, array<string>) => promise<execResult> = "execFile"
external exec: string => promise<execResult> = "exec"
}
}
4 changes: 2 additions & 2 deletions src/bindings/NodePromisified.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execFile as execFileCallback } from "child_process";
import { exec as execCallback } from "child_process";
import { promisify } from "util";

export const execFile = promisify(execFileCallback);
export const exec = promisify(execCallback);