summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Kogler <jakob.kogler@gmail.com>2021-12-05 22:33:26 +0100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-07 11:01:42 +1100
commitf981255a5b1c59afd065569dc8ea7e9993401955 (patch)
tree0b0ca963b73118db8b058b365d1a4578c446df47
parentbeedc2553d7b17ca8ac2827965980a2a6bd9fafb (diff)
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.
-rw-r--r--pkg/gui/gui.go5
1 files 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 {