reduce switch times a bit (#236)

This commit is contained in:
Vladimir Bauer 2019-10-07 21:08:39 +05:00 committed by gokcehan
parent bc33f3154a
commit cfc9e355b3

12
app.go
View File

@ -323,6 +323,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
cmd := shellCommand(s, args)
var out io.Reader
var err error
switch prefix {
case "$", "!":
cmd.Stdin = os.Stdin
@ -332,6 +333,8 @@ func (app *app) runShell(s string, args []string, prefix string) {
app.ui.pause()
defer app.ui.resume()
defer app.nav.renew()
err = cmd.Run()
case "%":
stdin, err := cmd.StdinPipe()
if err != nil {
@ -344,13 +347,8 @@ func (app *app) runShell(s string, args []string, prefix string) {
}
out = stdout
cmd.Stderr = cmd.Stdout
}
var err error
switch prefix {
case "$", "!":
err = cmd.Run()
case "%", "&":
fallthrough
case "&":
err = cmd.Start()
}