builder/vmware: better error output from vmrun

This commit is contained in:
Mitchell Hashimoto 2014-09-05 11:27:33 -07:00
parent f32d9879dc
commit ac58773eed
1 changed files with 6 additions and 1 deletions

View File

@ -129,7 +129,12 @@ func runAndLog(cmd *exec.Cmd) (string, string, error) {
stderrString := strings.TrimSpace(stderr.String()) stderrString := strings.TrimSpace(stderr.String())
if _, ok := err.(*exec.ExitError); ok { if _, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf("VMware error: %s", stderrString) message := stderrString
if message == "" {
message = stdoutString
}
err = fmt.Errorf("VMware error: %s", message)
} }
log.Printf("stdout: %s", stdoutString) log.Printf("stdout: %s", stdoutString)