1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00

Fix minor resource leak in runCmdHeadless

We still want to close the pty if the command failed.
This commit is contained in:
Stefan Haller 2023-09-09 13:38:11 +02:00
parent 10fe872c71
commit 26d180a50a

View File

@ -85,6 +85,7 @@ func runCmdHeadless(cmd *exec.Cmd) error {
_, _ = io.Copy(io.Discard, f) _, _ = io.Copy(io.Discard, f)
if cmd.Wait() != nil { if cmd.Wait() != nil {
_ = f.Close()
// return an error with the stderr output // return an error with the stderr output
return errors.New(stderr.String()) return errors.New(stderr.String())
} }