RunHostCommandSeparateStreams executes a command on the host and returns the stdout and error
(command string, args ...string)
| 176 | // RunHostCommandSeparateStreams executes a command on the host and returns the |
| 177 | // stdout and error |
| 178 | func RunHostCommandSeparateStreams(command string, args ...string) (string, error) { |
| 179 | if globalconfig.DdevVerbose { |
| 180 | output.UserOut.Printf("RunHostCommandSeparateStreams: %s %v", command, strings.Join(args, " ")) |
| 181 | } |
| 182 | c := HostCommand(command, args...) |
| 183 | c.Stdin = os.Stdin |
| 184 | o, err := c.Output() |
| 185 | if globalconfig.DdevVerbose { |
| 186 | output.UserOut.Printf("RunHostCommandSeparateStreams returned output=%v, err=%v", string(o), err) |
| 187 | } |
| 188 | |
| 189 | return string(o), err |
| 190 | } |
| 191 | |
| 192 | // CleanAndCopy removes control characters from output |
| 193 | func CleanAndCopy(dst io.Writer, src io.Reader) error { |