Revert "fix: use sudo for pip if available"

This reverts commit cd775009da.
This commit is contained in:
Amin Yahyaabadi 2021-09-16 15:52:45 -05:00
parent cd775009da
commit 1bafb63779
2 changed files with 3 additions and 11 deletions

View File

@ -5,7 +5,6 @@ import { addPath, info } from "@actions/core"
import { setupPython } from "../../python/python" import { setupPython } from "../../python/python"
import { isBinUptoDate } from "./version" import { isBinUptoDate } from "./version"
import { join } from "path" import { join } from "path"
import { mightSudo } from "./sudo"
let pip: string | undefined let pip: string | undefined
@ -25,10 +24,7 @@ export async function setupPipPack(name: string, version?: string) {
} }
} }
const exit = await exec(mightSudo(pip), [ const exit = await exec(pip, ["install", version !== undefined && version !== "" ? `${name}==${version}` : name])
"install",
version !== undefined && version !== "" ? `${name}==${version}` : name,
])
if (exit !== 0) { if (exit !== 0) {
throw new Error(`Failed to install ${name} ${version}`) throw new Error(`Failed to install ${name} ${version}`)
} }

View File

@ -10,12 +10,8 @@ export function isRoot(): boolean {
} }
export function mightSudo(command: string) { export function mightSudo(command: string) {
try { if (isRoot()) {
if (isRoot()) { return `sudo ${command}`
return `sudo ${command}`
}
} catch {
// ignore
} }
return command return command
} }