mirror of https://github.com/aminya/setup-cpp
fix: check if sudo is installed
This commit is contained in:
parent
c9b478842d
commit
e898202dcc
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,5 @@
|
|||
import execa from "execa"
|
||||
import which from "which"
|
||||
|
||||
let _issudo: boolean | undefined = undefined
|
||||
|
||||
|
@ -7,7 +8,7 @@ export function isRoot(): boolean {
|
|||
return _issudo
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions, @typescript-eslint/no-unnecessary-condition
|
||||
_issudo = Boolean(process.env.CI) || process.getuid?.() === 0
|
||||
_issudo = (Boolean(process.env.CI) || process.getuid?.() === 0) && which.sync("sudo", { nothrow: true }) !== null
|
||||
return _issudo
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue