From 1bafb6377965f27a409596ae0a312aa50cb8bad8 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 16 Sep 2021 15:52:45 -0500 Subject: [PATCH] Revert "fix: use sudo for pip if available" This reverts commit cd775009da92ac33e4f4be920b6983068fc19166. --- src/utils/setup/setupPipPack.ts | 6 +----- src/utils/setup/sudo.ts | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/utils/setup/setupPipPack.ts b/src/utils/setup/setupPipPack.ts index 5cc7d779..508ebbd7 100644 --- a/src/utils/setup/setupPipPack.ts +++ b/src/utils/setup/setupPipPack.ts @@ -5,7 +5,6 @@ import { addPath, info } from "@actions/core" import { setupPython } from "../../python/python" import { isBinUptoDate } from "./version" import { join } from "path" -import { mightSudo } from "./sudo" let pip: string | undefined @@ -25,10 +24,7 @@ export async function setupPipPack(name: string, version?: string) { } } - const exit = await exec(mightSudo(pip), [ - "install", - version !== undefined && version !== "" ? `${name}==${version}` : name, - ]) + const exit = await exec(pip, ["install", version !== undefined && version !== "" ? `${name}==${version}` : name]) if (exit !== 0) { throw new Error(`Failed to install ${name} ${version}`) } diff --git a/src/utils/setup/sudo.ts b/src/utils/setup/sudo.ts index 30154474..3d63afd6 100644 --- a/src/utils/setup/sudo.ts +++ b/src/utils/setup/sudo.ts @@ -10,12 +10,8 @@ export function isRoot(): boolean { } export function mightSudo(command: string) { - try { - if (isRoot()) { - return `sudo ${command}` - } - } catch { - // ignore + if (isRoot()) { + return `sudo ${command}` } return command }