Merge pull request #1873 from djimenez/detectShellWindows

Issue #1867 improve detectShell for windows
This commit is contained in:
Nathan LeClaire 2015-10-05 13:32:53 -07:00
commit bd03e83239
1 changed files with 5 additions and 8 deletions

View File

@ -491,19 +491,16 @@ func getCertPathInfoFromContext(c *cli.Context) cert.CertPathInfo {
}
func detectShell() (string, error) {
// check for windows env and not bash (i.e. msysgit, etc)
// the SHELL env var is not set for processes in msysgit; we check
// for TERM instead
if runtime.GOOS == "windows" && os.Getenv("TERM") != "cygwin" {
log.Printf("On Windows, please specify either 'cmd' or 'powershell' with the --shell flag.\n\n")
return "", ErrUnknownShell
}
// attempt to get the SHELL env var
shell := filepath.Base(os.Getenv("SHELL"))
log.Debugf("shell: %s", shell)
if shell == "" {
// check for windows env and not bash (i.e. msysgit, etc)
if runtime.GOOS == "windows" {
log.Printf("On Windows, please specify either 'cmd' or 'powershell' with the --shell flag.\n\n")
}
return "", ErrUnknownShell
}