From 26d180a50a29f667d3af3507683c76d8d0d88897 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 9 Sep 2023 13:38:11 +0200 Subject: [PATCH] Fix minor resource leak in runCmdHeadless We still want to close the pty if the command failed. --- pkg/integration/clients/go_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/integration/clients/go_test.go b/pkg/integration/clients/go_test.go index 01f174211..89d8a0653 100644 --- a/pkg/integration/clients/go_test.go +++ b/pkg/integration/clients/go_test.go @@ -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()) }