mirror of https://github.com/aminya/setup-cpp
Revert "fix: use sudo for pip if available"
This reverts commit cd775009da
.
This commit is contained in:
parent
cd775009da
commit
1bafb63779
|
@ -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}`)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue