builder/virtualbox: Output VBoxManage stderr in error

This commit is contained in:
Mitchell Hashimoto 2013-06-23 21:19:41 -07:00
parent 6031c8d820
commit d52cd1ed83
1 changed files with 9 additions and 2 deletions

View File

@ -88,8 +88,15 @@ func (d *VBox42Driver) VBoxManage(args ...string) error {
cmd.Stderr = &stderr
err := cmd.Run()
log.Printf("stdout: %s", strings.TrimSpace(stdout.String()))
log.Printf("stderr: %s", strings.TrimSpace(stderr.String()))
stdoutString := strings.TrimSpace(stdout.String())
stderrString := strings.TrimSpace(stderr.String())
if _, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf("VBoxManage error: %s", stderrString)
}
log.Printf("stdout: %s", stdoutString)
log.Printf("stderr: %s", stderrString)
return err
}