Hi Christopher, I don't mind, I know small english and go less, use sugestion
best you can
ipan
> Sent: Thursday, February 20, 2020 at 4:54 PM
> From: "Christopher Collins"
> To: "J. Ipanienko" , dev@mynewt.apache.org
> Subject: Re: windows shell scripts
>
> Thanks ipan, those are all very good points. Please feel free to submit
> one or more PRs. Otherwise, I will take a look at implementing some of
> these if you don't mind.
>
> Chris
>
> On Wed, Feb 19, 2020 at 10:26:53PM +0100, J. Ipanienko wrote:
> > Welcome everyone
> >
> > 1. mynewt has over 100 same cmd files with this content @bash "%~dp0%~n0.sh"
> >
> > 2. pre_build_cmds pre_link_cmds post_link_cmds probably can't be used with
> > .WINDOWS
> >
> > 3. go exec.Command and os.StartProcess will not run a file with the .sh
> > extension at Windows
> >
> > 4. debug and load for all bsp need bash
> >
> > 5. /bin/sh is hardcoded for linux and darwin
> >
> > so that you can have a common script for post_build, I suggest that newt
> > checks the extension of the command file and if it is .sh added bash.exe or
> > for example the value of the variable NEWT_SH
> >
> > then you could also get rid of those 100 cmd files
> >
> > this is a change that executes the same script on Windows (when NEWT_SH is
> > set to the path to bash.exe) and Linux, it also allows getting rid of .cmd
> > files from bsp
> >
> > diff --git a/util/util.go b/util/util.go
> > index ac92c28..c6a5638 100644
> > --- a/util/util.go
> > +++ b/util/util.go
> > @@ -369,8 +369,14 @@ func ShellCommandLimitDbgOutput(
> > name = "/bin/sh"
> > args = []string{"-c", strings.Replace(cmd, "\"", "\\\"",
> > -1)}
> > } else {
> > - name = cmdStrs[0]
> > - args = cmdStrs[1:]
> > + var newt_sh = os.Getenv("NEWT_SH")
> > + if newt_sh != "" && strings.HasSuffix(cmdStrs[0], ".sh") {
> > + name = newt_sh
> > + args = cmdStrs
> > + } else {
> > + name = cmdStrs[0]
> > + args = cmdStrs[1:]
> > + }
> > }
> > cmd := exec.Command(name, args...)
> >
> > @@ -428,6 +434,10 @@ func ShellInteractiveCommand(cmdStr []string, env
> > map[string]string,
> > // Escape special characters for Windows.
> > fixupCmdArgs(cmdStr)
> >
> > + var newt_sh = os.Getenv("NEWT_SH")
> > + if newt_sh != "" && strings.HasSuffix(cmdStr[0], ".sh") {
> > + cmdStr = append([]string{newt_sh}, cmdStr...)
> > + }
> > log.Print("[VERBOSE] " + cmdStr[0])
> >
> > c := make(chan os.Signal, 1)
> >
> >
> > god luck
> > ipan
> >
>