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 }