mirror of https://github.com/docker/docs.git
Fix #2717, Driver vmwarefusion fail because of soft link
Signed-off-by: rediceli <redice.li@qq.com>
This commit is contained in:
parent
626bd0df89
commit
ccb8c31827
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -200,7 +201,11 @@ func (d *Driver) GetIP() (string, error) {
|
||||||
|
|
||||||
func (d *Driver) GetState() (state.State, error) {
|
func (d *Driver) GetState() (state.State, error) {
|
||||||
// VMRUN only tells use if the vm is running or not
|
// VMRUN only tells use if the vm is running or not
|
||||||
if stdout, _, _ := vmrun("list"); strings.Contains(stdout, d.vmxPath()) {
|
vmxp, err := filepath.EvalSymlinks(d.vmxPath())
|
||||||
|
if err != nil {
|
||||||
|
return state.Error, err
|
||||||
|
}
|
||||||
|
if stdout, _, _ := vmrun("list"); strings.Contains(stdout, vmxp) {
|
||||||
return state.Running, nil
|
return state.Running, nil
|
||||||
}
|
}
|
||||||
return state.Stopped, nil
|
return state.Stopped, nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue