MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / SudoHandleCmd

Function SudoHandleCmd

agent/utils/cmd/cmd.go:32–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30}
31
32func SudoHandleCmd() string {
33 sudoCheckOnce.Do(func() {
34 cmd := exec.Command("sudo", "-n", "ls")
35 if err := cmd.Run(); err == nil {
36 sudoHandleCmd = "sudo "
37 }
38 })
39 return sudoHandleCmd
40}
41
42func WrapWithOptionalSudo(name string, args ...string) (string, []string) {
43 if SudoHandleCmd() == "" {

Callers 2

WrapWithOptionalSudoFunction · 0.70

Calls 1

RunMethod · 0.65

Tested by

no test coverage detected