summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-04-28 15:55:30 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-04-28 16:01:19 +0900
commit159a37fa377ab7202ec67e1675a3e2a955c8291d (patch)
treed689e8029a1d7725823178d2476a744684f56558
parentf39ae0e7c1fdb3a5ece8a25b95a8808ff029d632 (diff)
Restore CmdLine parameter when running commands using cmd.exe
-rw-r--r--src/util/util_windows.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/util/util_windows.go b/src/util/util_windows.go
index cbaa8ce0..e0ab9e3a 100644
--- a/src/util/util_windows.go
+++ b/src/util/util_windows.go
@@ -57,10 +57,20 @@ func (x *Executor) ExecCommand(command string, setpgid bool) *exec.Cmd {
}
x.shellPath.Store(shell)
}
- cmd := exec.Command(shell, append(x.args, command)...)
- cmd.SysProcAttr = &syscall.SysProcAttr{
- HideWindow: false,
- CreationFlags: 0,
+ var cmd *exec.Cmd
+ if strings.Contains(shell, "cmd") {
+ cmd = exec.Command(shell)
+ cmd.SysProcAttr = &syscall.SysProcAttr{
+ HideWindow: false,
+ CmdLine: fmt.Sprintf(`%s "%s"`, strings.Join(x.args, " "), command),
+ CreationFlags: 0,
+ }
+ } else {
+ cmd = exec.Command(shell, append(x.args, command)...)
+ cmd.SysProcAttr = &syscall.SysProcAttr{
+ HideWindow: false,
+ CreationFlags: 0,
+ }
}
return cmd
}