Run executes a command and prints the output when terminates with an error
(command string)
| 85 | |
| 86 | // Run executes a command and prints the output when terminates with an error |
| 87 | func Run(command string) (stdout string, stderr string, err error) { |
| 88 | stdout, stderr, err = Unchecked(command) |
| 89 | |
| 90 | var exerr *exec.ExitError |
| 91 | if errors.As(err, &exerr) { |
| 92 | ginkgo.GinkgoWriter.Printf("RunCheck: %v\nExitCode: %v\n Out:\n%v\nErr:\n%v\n", |
| 93 | command, exerr.ExitCode(), stdout, stderr) |
| 94 | } |
| 95 | return stdout, stderr, err |
| 96 | } |