machine-drivers / machine

Machine management for a container-centric world
Apache License 2.0
25 stars 16 forks source link

Correctly detect powershell when ssh to windows machine. #33

Closed hetong07 closed 3 years ago

hetong07 commented 3 years ago

Description

When ssh to a windows machine, the Detect() will return powershell.exe rather than powershell. It is due to the fact that the os.getenv() returns the absolute path to powershell rather then an empty string, which causes this issue.

fmt.Printf("%v\n",os.Getenv("SHELL"))
c:\windows\system32\windowspowershell\v1.0\powershell.exe

Related issue(s)

afbjorklund commented 3 years ago

@hetong07 : This would need an upstream issue and PR as well, at https://github.com/docker/machine

Returning the full path sounds normal for $SHELL, for instance /bin/bash. So it's just that DOS .exe