fix: fix binDir for choco

This commit is contained in:
Amin Yahyaabadi 2021-09-16 15:08:54 -05:00
parent a6648a2296
commit 28f7f1fb27
1 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { exec } from "@actions/exec" import { exec } from "@actions/exec"
import { existsSync } from "fs"
import which from "which" import which from "which"
import { InstallationInfo } from "../utils/setup/setupBin" import { InstallationInfo } from "../utils/setup/setupBin"
@ -35,5 +36,11 @@ export async function setupChocolatey(
throw new Error(`Failed to install chocolatey`) throw new Error(`Failed to install chocolatey`)
} }
return { binDir: which.sync("choco", { nothrow: true }) ?? "C:\\ProgramData\\Chocolatey\\bin\\" } // eslint-disable-next-line require-atomic-updates
binDir = which.sync("choco", { nothrow: true }) ?? "C:\\ProgramData\\Chocolatey\\bin\\"
if (existsSync(binDir)) {
return { binDir }
}
return undefined
} }