From 443b222025977485deb6a4fe6a042bda46a523c5 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Fri, 5 Aug 2022 13:17:10 +0300 Subject: [PATCH] fix: Add ps.Kill/Wait to test cleanup in `ptytest.Start` --- pty/ptytest/ptytest.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pty/ptytest/ptytest.go b/pty/ptytest/ptytest.go index 90bad7f72d7c8..7abec9f181833 100644 --- a/pty/ptytest/ptytest.go +++ b/pty/ptytest/ptytest.go @@ -35,6 +35,10 @@ func Start(t *testing.T, cmd *exec.Cmd) (*PTY, pty.Process) { ptty, ps, err := pty.Start(cmd) require.NoError(t, err) + t.Cleanup(func() { + _ = ps.Kill() + _ = ps.Wait() + }) return create(t, ptty, cmd.Args[0]), ps }