Merge pull request #79 from andyz-dev/extra-log
[Enhancement] Log more information when the docker-machine command fails
This commit is contained in:
commit
bd5d7a6268
@ -1,6 +1,7 @@
|
||||
package run
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
@ -19,8 +20,16 @@ func getDockerMachineIp() (string, error) {
|
||||
}
|
||||
|
||||
out, err := exec.Command(dockerMachinePath, "ip", machine).Output()
|
||||
if err != nil {
|
||||
log.Printf("Error executing 'docker-machine ip'")
|
||||
|
||||
if exitError, ok := err.(*exec.ExitError); ok {
|
||||
log.Printf("%s", string(exitError.Stderr))
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
ipStr := strings.TrimSuffix(string(out), "\n")
|
||||
ipStr = strings.TrimSuffix(ipStr, "\r")
|
||||
return ipStr, err
|
||||
|
||||
return ipStr, nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user