From f981255a5b1c59afd065569dc8ea7e9993401955 Mon Sep 17 00:00:00 2001 From: Jakob Kogler Date: Sun, 5 Dec 2021 22:33:26 +0100 Subject: [PATCH] don't ignore error when commit with subprocess fails If signing by GPG is enabled, the git commit command will be executed in a subprocess, differently from when it is executed without GPG signing. In case of an error, e.g. a failing pre-commit hook, the error needs to be passed along, and not just ignored. --- pkg/gui/gui.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 08960ff16..f0e9df536 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -634,7 +634,8 @@ func (gui *Gui) runSubprocess(cmdObj oscommands.ICmdObj) error { fmt.Fprintf(os.Stdout, "\n%s\n\n", style.FgBlue.Sprint("+ "+strings.Join(subprocess.Args, " "))) - if err := subprocess.Run(); err != nil { + err := subprocess.Run() + if err != nil { // not handling the error explicitly because usually we're going to see it // in the output anyway gui.Log.Error(err) @@ -647,7 +648,7 @@ func (gui *Gui) runSubprocess(cmdObj oscommands.ICmdObj) error { fmt.Fprintf(os.Stdout, "\n%s", style.FgGreen.Sprint(gui.Tr.PressEnterToReturn)) fmt.Scanln() // wait for enter press - return nil + return err } func (gui *Gui) loadNewRepo() error {