allow using special characters in external commands (#1652) (#1868)

on Windows, when using cmd.exe or a bat file as external command.
This commit is contained in:
Alessandro Ros
2023-05-27 18:20:06 +02:00
committed by GitHub
parent 27a2418663
commit a0b973963d
3 changed files with 54 additions and 30 deletions

View File

@@ -11,13 +11,13 @@ import (
"github.com/kballard/go-shellquote"
)
func (e *Cmd) runInner() (int, bool) {
cmdparts, err := shellquote.Split(e.cmdstr)
func (e *Cmd) runOSSpecific() (int, bool) {
cmdParts, err := shellquote.Split(e.cmdstr)
if err != nil {
return 0, true
}
cmd := exec.Command(cmdparts[0], cmdparts[1:]...)
cmd := exec.Command(cmdParts[0], cmdParts[1:]...)
cmd.Env = append([]string(nil), os.Environ()...)
for key, val := range e.env {