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

Function WrapWithOptionalSudo

agent/utils/cmd/cmd.go:42–47  ·  view source on GitHub ↗
(name string, args ...string)

Source from the content-addressed store, hash-verified

40}
41
42func WrapWithOptionalSudo(name string, args ...string) (string, []string) {
43 if SudoHandleCmd() == "" {
44 return name, args
45 }
46 return "sudo", append([]string{"-n", name}, args...)
47}
48
49func ExecCommandWithOptionalSudo(name string, args ...string) *exec.Cmd {
50 commandName, commandArgs := WrapWithOptionalSudo(name, args...)

Callers 3

RunWithOptionalSudoMethod · 0.85

Calls 1

SudoHandleCmdFunction · 0.70

Tested by

no test coverage detected