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-25 09:09:41 +02:00
parent 10fe872c71
commit 26d180a50a
+1
View File
@@ -85,6 +85,7 @@ func runCmdHeadless(cmd *exec.Cmd) error {
_, _ = io.Copy(io.Discard, f)
if cmd.Wait() != nil {
_ = f.Close()
// return an error with the stderr output
return errors.New(stderr.String())
}