Improve windows shell handling
This commit is contained in:
1 file changed
+9
-4
+9
-4
@@ -101,11 +101,16 @@ func detachedCommand(name string, arg ...string) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func shellCommand(s string, args []string) *exec.Cmd {
|
func shellCommand(s string, args []string) *exec.Cmd {
|
||||||
args = append([]string{gOpts.shellflag, s}, args...)
|
var builder strings.Builder
|
||||||
|
builder.WriteString(s)
|
||||||
|
for _, arg := range args {
|
||||||
|
fmt.Fprintf(&builder, ` "%s"`, arg)
|
||||||
|
}
|
||||||
|
cmdline := fmt.Sprintf(`%s %s "%s"`, gOpts.shellopts, gOpts.shellflag, builder.String())
|
||||||
|
|
||||||
args = append(gOpts.shellopts, args...)
|
cmd := exec.Command(gOpts.shell)
|
||||||
|
cmd.SysProcAttr = &windows.SysProcAttr{CmdLine: cmdline}
|
||||||
return exec.Command(gOpts.shell, args...)
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func shellSetPG(cmd *exec.Cmd) {
|
func shellSetPG(cmd *exec.Cmd) {
|
||||||
|
|||||||
Reference in new issue
Block a user