From 1dfca96c6939e27a97dfa3ac0ce8d6a522ae1adf Mon Sep 17 00:00:00 2001 From: Donovan Jimenez Date: Thu, 17 Sep 2015 14:56:46 -0400 Subject: [PATCH] Issue #1867 improve detectShell for windows newer versions of git bash use mintty which doesn't set TERM=cygwin but does set SHELL appropriately. Allow for SHELL to be detected on windows and only output the message if its not. Signed-off-by: Donovan Jimenez --- commands/commands.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/commands/commands.go b/commands/commands.go index cbb59fa42b..b4ab1308c7 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -659,19 +659,16 @@ func getCertPathInfo(c *cli.Context) libmachine.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 }