From 1a81d4edde0a3fc089ef9f6c2aa568a0b845f237 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 17 Sep 2021 15:08:19 -0500 Subject: [PATCH] fix: fix cross-spawn exit codes --- src/utils/setup/setupAptPack.ts | 2 +- src/utils/setup/setupChocoPack.ts | 2 +- src/utils/setup/setupPipPack.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/setup/setupAptPack.ts b/src/utils/setup/setupAptPack.ts index 01b1362e..af04810e 100644 --- a/src/utils/setup/setupAptPack.ts +++ b/src/utils/setup/setupAptPack.ts @@ -30,7 +30,7 @@ export function setupAptPack(name: string, version?: string, repository: boolean exit = spawn.sync(apt, ["install", name], { stdio: "inherit" }).status } - if (exit !== 0) { + if (exit !== 0 && exit !== null) { throw new Error(`Failed to install ${name} ${version}`) } diff --git a/src/utils/setup/setupChocoPack.ts b/src/utils/setup/setupChocoPack.ts index 668f8f2d..bb262986 100644 --- a/src/utils/setup/setupChocoPack.ts +++ b/src/utils/setup/setupChocoPack.ts @@ -21,7 +21,7 @@ export async function setupChocoPack(name: string, version?: string, args: strin exit = spawn.sync("choco", ["install", "-y", name, ...args], { stdio: "inherit" }).status } - if (exit !== 0) { + if (exit !== 0 && exit !== null) { throw new Error(`Failed to install ${name} ${version}`) } diff --git a/src/utils/setup/setupPipPack.ts b/src/utils/setup/setupPipPack.ts index e393a51f..1a0c2738 100644 --- a/src/utils/setup/setupPipPack.ts +++ b/src/utils/setup/setupPipPack.ts @@ -28,7 +28,7 @@ export async function setupPipPack(name: string, version?: string) { const exit = spawn.sync(pip, ["install", version !== undefined && version !== "" ? `${name}==${version}` : name], { stdio: "inherit", }).status - if (exit !== 0) { + if (exit !== 0 && exit !== null) { throw new Error(`Failed to install ${name} ${version}`) }