1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-22 05:29:44 +02:00

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.
This commit is contained in:
Jakob Kogler 2021-12-05 22:33:26 +01:00 committed by Jesse Duffield
parent beedc2553d
commit f981255a5b

View File

@ -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, " "))) 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 // not handling the error explicitly because usually we're going to see it
// in the output anyway // in the output anyway
gui.Log.Error(err) 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.Fprintf(os.Stdout, "\n%s", style.FgGreen.Sprint(gui.Tr.PressEnterToReturn))
fmt.Scanln() // wait for enter press fmt.Scanln() // wait for enter press
return nil return err
} }
func (gui *Gui) loadNewRepo() error { func (gui *Gui) loadNewRepo() error {