bubble up errors on command running

This commit is contained in:
Clément PÉAU 2024-06-16 00:16:06 +02:00
parent 80af149b02
commit 0beb4dd4d4

View file

@ -26,7 +26,7 @@ func (gui *Gui) runSubprocessWithMessage(cmd *exec.Cmd, msg string) error {
gui.PauseBackgroundThreads = true
gui.runCommand(cmd, msg)
err := gui.runCommand(cmd, msg)
if err := gui.g.Resume(); err != nil {
return gui.createErrorPanel(err.Error())
@ -34,7 +34,7 @@ func (gui *Gui) runSubprocessWithMessage(cmd *exec.Cmd, msg string) error {
gui.PauseBackgroundThreads = false
return nil
return err
}
func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
@ -58,9 +58,9 @@ func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
if msg != "" {
fmt.Fprintf(os.Stdout, "\n%s\n\n", utils.ColoredString(msg, color.FgGreen))
}
if err := cmd.Run(); err != nil {
// not handling the error explicitly because usually we're going to see it
// in the output anyway
err := cmd.Run()
if err != nil {
gui.Log.Error(err)
}
@ -69,4 +69,6 @@ func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
cmd.Stderr = io.Discard
gui.promptToReturn()
return err
}