RunHostCommand executes a command on the host and returns the combined stdout/stderr results and error
(command string, args ...string)
| 135 | // RunHostCommand executes a command on the host and returns the |
| 136 | // combined stdout/stderr results and error |
| 137 | func 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 |