Skip to content

Commit

Permalink
change root detection
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Sep 28, 2023
1 parent 6726c4d commit 3dda5f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/utils/btf.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"debug/elf"
"fmt"
"os"
"os/exec"
"strings"
)
Expand Down Expand Up @@ -37,7 +36,8 @@ func RunCMD(ctx context.Context, cwd string, binary string, args ...string) erro
}

func SudoCMD(binary string, args ...string) (string, []string) {
if os.Getuid() != 0 {
_, err := exec.LookPath("sudo")
if err == nil {
return "sudo", append([]string{binary}, args...)
}
return binary, args
Expand Down

0 comments on commit 3dda5f7

Please sign in to comment.