fix: Add ps.Kill/Wait to test cleanup in `ptytest.Start` (#3387)

This commit is contained in:
Mathias Fredriksson 2022-08-05 13:35:33 +03:00 committed by GitHub
parent fb9fca8bc9
commit 46d64c624a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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
}