mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
bubble up errors on command running
This commit is contained in:
parent
80af149b02
commit
0beb4dd4d4
1 changed files with 7 additions and 5 deletions
|
|
@ -26,7 +26,7 @@ func (gui *Gui) runSubprocessWithMessage(cmd *exec.Cmd, msg string) error {
|
||||||
|
|
||||||
gui.PauseBackgroundThreads = true
|
gui.PauseBackgroundThreads = true
|
||||||
|
|
||||||
gui.runCommand(cmd, msg)
|
err := gui.runCommand(cmd, msg)
|
||||||
|
|
||||||
if err := gui.g.Resume(); err != nil {
|
if err := gui.g.Resume(); err != nil {
|
||||||
return gui.createErrorPanel(err.Error())
|
return gui.createErrorPanel(err.Error())
|
||||||
|
|
@ -34,7 +34,7 @@ func (gui *Gui) runSubprocessWithMessage(cmd *exec.Cmd, msg string) error {
|
||||||
|
|
||||||
gui.PauseBackgroundThreads = false
|
gui.PauseBackgroundThreads = false
|
||||||
|
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
|
func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
|
||||||
|
|
@ -58,9 +58,9 @@ func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
fmt.Fprintf(os.Stdout, "\n%s\n\n", utils.ColoredString(msg, color.FgGreen))
|
fmt.Fprintf(os.Stdout, "\n%s\n\n", utils.ColoredString(msg, color.FgGreen))
|
||||||
}
|
}
|
||||||
if err := cmd.Run(); err != nil {
|
err := cmd.Run()
|
||||||
// not handling the error explicitly because usually we're going to see it
|
|
||||||
// in the output anyway
|
if err != nil {
|
||||||
gui.Log.Error(err)
|
gui.Log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,4 +69,6 @@ func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
|
||||||
cmd.Stderr = io.Discard
|
cmd.Stderr = io.Discard
|
||||||
|
|
||||||
gui.promptToReturn()
|
gui.promptToReturn()
|
||||||
|
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue