Skip to content

Commit

Permalink
Refactor: minor cleanup of async shell functions
Browse files Browse the repository at this point in the history
After the previous refactors, the logic for async shell commands can
be simplified somewhat. There is likely room for further improvements,
but that is beyond the scope of this PR.
  • Loading branch information
ilyagr committed May 13, 2023
1 parent 468c0a7 commit a97917a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,8 @@ func (app *app) runShell(s string, args []string, prefix string) {
}

// We are running the command asynchroniously
switch prefix {
case "%":
shellSetPG(cmd)
if prefix == "%" {
shellSetPG(cmd) // TODO: Delete or document the reason to do this twice for % mode
if app.ui.cmdPrefix == ">" {
return
}
Expand All @@ -545,12 +544,10 @@ func (app *app) runShell(s string, args []string, prefix string) {
}
out = stdout
cmd.Stderr = cmd.Stdout
fallthrough
case "&":
shellSetPG(cmd)
err = cmd.Start()
}

shellSetPG(cmd)
err = cmd.Start()
if err != nil {
app.ui.echoerrf("running shell: %s", err)
}
Expand Down

0 comments on commit a97917a

Please sign in to comment.