mirror of
https://github.com/docker/docs.git
synced 2026-11-05 00:14:17 +03:00
Merge pull request #2097 from dgageot/better-vbox-error-message
Print a better error when virtualbox fails
This commit is contained in:
@@ -61,17 +61,21 @@ func (v *VBoxCmdManager) vbmOutErr(args ...string) (string, string, error) {
|
||||
log.Debugf("STDOUT:\n{\n%v}", stdout.String())
|
||||
log.Debugf("STDERR:\n{\n%v}", stderrStr)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound {
|
||||
err = ErrVBMNotFound
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if err == nil || strings.HasPrefix(err.Error(), "exit status ") {
|
||||
// VBoxManage will sometimes not set the return code, but has a fatal error
|
||||
// such as VBoxManage.exe: error: VT-x is not available. (VERR_VMX_NO_VMX)
|
||||
if strings.Contains(stderrStr, "error:") {
|
||||
err = fmt.Errorf("%v %v failed: %v", vboxManageCmd, strings.Join(args, " "), stderrStr)
|
||||
err = fmt.Errorf("%v %v failed:\n%v", vboxManageCmd, strings.Join(args, " "), stderrStr)
|
||||
}
|
||||
}
|
||||
|
||||
return stdout.String(), stderrStr, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user