mirror of https://github.com/aminya/setup-cpp
fix: handle the reboot requirement for choco installations
This commit is contained in:
parent
b88fe129ce
commit
cdc356e02b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,7 @@ import { setupChocolatey } from "../../chocolatey/chocolatey"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
|
import { notice } from "../io/io"
|
||||||
|
|
||||||
let hasChoco = false
|
let hasChoco = false
|
||||||
|
|
||||||
|
@ -32,7 +33,16 @@ export async function setupChocoPack(name: string, version?: string, args: strin
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
execa.sync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" })
|
try {
|
||||||
|
execa.sync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" })
|
||||||
|
} catch (err) {
|
||||||
|
// if the package requires a reboot, downgrade the error to a notice
|
||||||
|
if ((err as Error).message.includes("exit code 3010")) {
|
||||||
|
notice(`${name} might require a reboot for the completion of the installation.`)
|
||||||
|
} else {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`
|
const binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`
|
||||||
|
|
Loading…
Reference in New Issue