use cmd.exe pause command for waiting on windows

Mentioned in #12.
This commit is contained in:
Gokcehan 2017-08-02 19:52:48 +03:00
parent d7fca734c8
commit 6631cdb23b

9
app.go
View File

@ -5,6 +5,7 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"runtime"
"strconv" "strconv"
"strings" "strings"
) )
@ -45,7 +46,12 @@ func waitKey() error {
stty $old stty $old
echo` echo`
cmd := exec.Command(gOpts.shell, "-c", c) var cmd *exec.Cmd
if runtime.GOOS == "windows" {
cmd = exec.Command("cmd", "/c", "pause")
} else {
cmd = exec.Command(gOpts.shell, "-c", c)
}
cmd.Stdin = os.Stdin cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
@ -135,6 +141,7 @@ func (app *app) runShell(s string, args []string, wait bool, async bool) {
} }
args = append([]string{"-c", s, "--"}, args...) args = append([]string{"-c", s, "--"}, args...)
cmd := exec.Command(gOpts.shell, args...) cmd := exec.Command(gOpts.shell, args...)
if !async { if !async {