fix: skip choco installation on non-windows

This commit is contained in:
Amin Yahyaabadi 2021-09-15 00:37:37 -05:00
parent b085463827
commit 649aac71b9
2 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,9 @@ jest.setTimeout(100000)
describe("setup-chocolatey", () => { describe("setup-chocolatey", () => {
it("should setup chocolatey", async () => { it("should setup chocolatey", async () => {
if (process.platform !== "win32") {
return
}
await setupChocolatey() await setupChocolatey()
const { status } = spawn("choco", ["--version"], { const { status } = spawn("choco", ["--version"], {

View File

@ -2,6 +2,10 @@ import { exec } from "@actions/exec"
import which from "which" import which from "which"
export async function setupChocolatey() { export async function setupChocolatey() {
if (process.platform !== "win32") {
return
}
if (which.sync("choco", { nothrow: true }) !== null) { if (which.sync("choco", { nothrow: true }) !== null) {
return return
} }