mirror of https://github.com/aminya/setup-cpp
fix: install brew synchronously
This commit is contained in:
parent
eaec708616
commit
841f079886
|
@ -1,7 +1,7 @@
|
|||
import { exec } from "@actions/exec"
|
||||
import { execFileSync } from "child_process"
|
||||
import which from "which"
|
||||
|
||||
export async function setupBrew() {
|
||||
export function setupBrew() {
|
||||
if (!["darwin", "linux"].includes(process.platform)) {
|
||||
return
|
||||
}
|
||||
|
@ -10,11 +10,8 @@ export async function setupBrew() {
|
|||
return
|
||||
}
|
||||
|
||||
const exit = await exec(
|
||||
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
|
||||
)
|
||||
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to install brew`)
|
||||
}
|
||||
// brew is not thread-safe
|
||||
execFileSync(`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`, {
|
||||
stdio: "inherit",
|
||||
})
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import { setupBrew } from "../../brew/brew"
|
|||
let hasBrew = false
|
||||
|
||||
/** A function that installs a package using brew */
|
||||
export async function setupBrewPack(name: string, version?: string) {
|
||||
export function setupBrewPack(name: string, version?: string) {
|
||||
if (!hasBrew || which.sync("brew", { nothrow: true }) === null) {
|
||||
await setupBrew()
|
||||
setupBrew()
|
||||
hasBrew = true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue