reduce switch times a bit (#236)
This commit is contained in:
parent
bc33f3154a
commit
cfc9e355b3
12
app.go
12
app.go
@ -323,6 +323,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
cmd := shellCommand(s, args)
|
cmd := shellCommand(s, args)
|
||||||
|
|
||||||
var out io.Reader
|
var out io.Reader
|
||||||
|
var err error
|
||||||
switch prefix {
|
switch prefix {
|
||||||
case "$", "!":
|
case "$", "!":
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
@ -332,6 +333,8 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
app.ui.pause()
|
app.ui.pause()
|
||||||
defer app.ui.resume()
|
defer app.ui.resume()
|
||||||
defer app.nav.renew()
|
defer app.nav.renew()
|
||||||
|
|
||||||
|
err = cmd.Run()
|
||||||
case "%":
|
case "%":
|
||||||
stdin, err := cmd.StdinPipe()
|
stdin, err := cmd.StdinPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -344,13 +347,8 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
}
|
}
|
||||||
out = stdout
|
out = stdout
|
||||||
cmd.Stderr = cmd.Stdout
|
cmd.Stderr = cmd.Stdout
|
||||||
}
|
fallthrough
|
||||||
|
case "&":
|
||||||
var err error
|
|
||||||
switch prefix {
|
|
||||||
case "$", "!":
|
|
||||||
err = cmd.Run()
|
|
||||||
case "%", "&":
|
|
||||||
err = cmd.Start()
|
err = cmd.Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user