This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
The following commit(s) were added to refs/heads/master by this push: new 8330e7f Execute .sh scripts with bash on windows 8330e7f is described below commit 8330e7f8bd6570e2bccb73377b115ab78541933d Author: J. Ipanienko <j.ipanie...@mexicomail.com> AuthorDate: Wed Feb 19 13:19:16 2020 -0800 Execute .sh scripts with bash on windows --- util/util.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/util/util.go b/util/util.go index 91e8aed..d693f1a 100644 --- a/util/util.go +++ b/util/util.go @@ -369,8 +369,17 @@ func ShellCommandLimitDbgOutput( name = "/bin/sh" args = []string{"-c", strings.Replace(cmd, "\"", "\\\"", -1)} } else { - name = cmdStrs[0] - args = cmdStrs[1:] + if strings.HasSuffix(cmdStrs[0], ".sh") { + var newt_sh = os.Getenv("NEWT_SH") + if newt_sh == "" { + newt_sh = "bash" + } + name = newt_sh + args = cmdStrs + } else { + name = cmdStrs[0] + args = cmdStrs[1:] + } } cmd := exec.Command(name, args...) @@ -428,6 +437,18 @@ func ShellInteractiveCommand(cmdStr []string, env map[string]string, // Escape special characters for Windows. fixupCmdArgs(cmdStr) + var newt_sh string + if runtime.GOOS == "windows" && strings.HasSuffix(cmdStr[0], ".sh") { + newt_sh = os.Getenv("NEWT_SH") + if newt_sh == "" { + bash, err := exec.LookPath("bash") + if err != nil { + return err + } + newt_sh = bash + } + cmdStr = append([]string{newt_sh}, cmdStr...) + } log.Print("[VERBOSE] " + cmdStr[0]) c := make(chan os.Signal, 1)