Fix: Inverse check on IsRoot
This commit is contained in:
parent
395f5ab6bc
commit
2cec7b2e05
1 changed files with 2 additions and 2 deletions
|
@ -63,7 +63,7 @@ func RunErr(binary string, args ...string) ([]string, []string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunErrSudo(isRoot bool, binary string, args ...string) ([]string, []string, error) {
|
func RunErrSudo(isRoot bool, binary string, args ...string) ([]string, []string, error) {
|
||||||
if isRoot && binary != "sudo" {
|
if !isRoot && binary != "sudo" {
|
||||||
args = append([]string{binary}, args...)
|
args = append([]string{binary}, args...)
|
||||||
binary = "sudo"
|
binary = "sudo"
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ func Clear() {
|
||||||
// noisy isn't set to true by our copy caller, as it logs differently,
|
// noisy isn't set to true by our copy caller, as it logs differently,
|
||||||
// but other callers set it.
|
// but other callers set it.
|
||||||
func ExecAndLogSudo(isRoot, noisy bool, cmd string) error {
|
func ExecAndLogSudo(isRoot, noisy bool, cmd string) error {
|
||||||
if isRoot && !strings.HasPrefix(cmd, "sudo") {
|
if !isRoot && !strings.HasPrefix(cmd, "sudo") {
|
||||||
cmd = fmt.Sprintf("sudo %s", cmd)
|
cmd = fmt.Sprintf("sudo %s", cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue