MCPcopy
hub / github.com/cloudflare/cloudflared / runCommand

Function runCommand

cmd/cloudflared/service_template.go:92–109  ·  view source on GitHub ↗
(command string, args ...string)

Source from the content-addressed store, hash-verified

90}
91
92func runCommand(command string, args ...string) error {
93 cmd := exec.Command(command, args...)
94 stderr, err := cmd.StderrPipe()
95 if err != nil {
96 return fmt.Errorf("error getting stderr pipe: %v", err)
97 }
98 err = cmd.Start()
99 if err != nil {
100 return fmt.Errorf("error starting %s: %v", command, err)
101 }
102
103 output, _ := io.ReadAll(stderr)
104 err = cmd.Wait()
105 if err != nil {
106 return fmt.Errorf("%s %v returned with error code %v due to: %v", command, args, err, string(output))
107 }
108 return nil
109}

Callers 6

installLaunchdFunction · 0.70
uninstallLaunchdFunction · 0.70
installSystemdFunction · 0.70
installSysvFunction · 0.70
uninstallSystemdFunction · 0.70
uninstallSysvFunction · 0.70

Calls 3

ErrorfMethod · 0.80
WaitMethod · 0.80
StartMethod · 0.65

Tested by

no test coverage detected