Skip to content

Commit cdc356e

Browse files
committed
fix: handle the reboot requirement for choco installations
1 parent b88fe12 commit cdc356e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/setup/setupChocoPack.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { setupChocolatey } from "../../chocolatey/chocolatey"
55
import { InstallationInfo } from "./setupBin"
66
import execa from "execa"
77
import { info } from "@actions/core"
8+
import { notice } from "../io/io"
89

910
let hasChoco = false
1011

@@ -32,7 +33,16 @@ export async function setupChocoPack(name: string, version?: string, args: strin
3233
stdio: "inherit",
3334
})
3435
} else {
35-
execa.sync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" })
36+
try {
37+
execa.sync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" })
38+
} catch (err) {
39+
// if the package requires a reboot, downgrade the error to a notice
40+
if ((err as Error).message.includes("exit code 3010")) {
41+
notice(`${name} might require a reboot for the completion of the installation.`)
42+
} else {
43+
throw err
44+
}
45+
}
3646
}
3747

3848
const binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`

0 commit comments

Comments
 (0)