diff --git a/pkg/utils/btf.go b/pkg/utils/btf.go index 56b9223f..07f8b0b8 100644 --- a/pkg/utils/btf.go +++ b/pkg/utils/btf.go @@ -5,7 +5,6 @@ import ( "context" "debug/elf" "fmt" - "os" "os/exec" "strings" ) @@ -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