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 14, 2023
1 parent 8f4e25a commit 0089731
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 @@ -526,9 +526,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 @@ -543,12 +542,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 0089731

Please sign in to comment.