MCPcopy Index your code
hub / github.com/ddev/ddev / RunHostCommand

Function RunHostCommand

pkg/exec/exec.go:137–149  ·  view source on GitHub ↗

RunHostCommand executes a command on the host and returns the combined stdout/stderr results and error

(command string, args ...string)

Source from the content-addressed store, hash-verified

135// RunHostCommand executes a command on the host and returns the
136// combined stdout/stderr results and error
137func RunHostCommand(command string, args ...string) (string, error) {
138 if globalconfig.DdevVerbose {
139 output.UserOut.Printf("RunHostCommand: %s %v", command, strings.Join(args, " "))
140 }
141 c := HostCommand(command, args...)
142 c.Stdin = os.Stdin
143 o, err := c.CombinedOutput()
144 if globalconfig.DdevVerbose {
145 output.UserOut.Printf("RunHostCommand returned output=%v err=%v", string(bytes.TrimSpace(o)), err)
146 }
147
148 return string(o), err
149}
150
151// RunHostCommandWithOptions executes a command on the host with configurable options
152// and returns the combined stdout/stderr results and error

Callers 15

TestConfigFunctionalityFunction · 0.92
setupPlatformProjectFunction · 0.92
TestMainFunction · 0.92
TestDdevXdebugEnabledFunction · 0.92
TestDdevAllDatabasesFunction · 0.92
TestHostDBPortFunction · 0.92

Calls 1

HostCommandFunction · 0.85

Tested by 15

TestConfigFunctionalityFunction · 0.74
setupPlatformProjectFunction · 0.74
TestMainFunction · 0.74
TestDdevXdebugEnabledFunction · 0.74
TestDdevAllDatabasesFunction · 0.74
TestHostDBPortFunction · 0.74