From 7a565fa4fe2b3a093a7f99f3524972353f66932d Mon Sep 17 00:00:00 2001 From: Mskxn <118117161+Mskxn@users.noreply.github.com> Date: Wed, 12 Jul 2023 03:27:48 +0800 Subject: [PATCH] console: add cleanup to avoid leaks in newTester (#27695) --- console/console_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/console/console_test.go b/console/console_test.go index 4b8f943c9e..ee5c36be4a 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -111,6 +111,10 @@ func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester { t.Fatalf("failed to start test stack: %v", err) } client := stack.Attach() + t.Cleanup(func() { + client.Close() + }) + prompter := &hookedPrompter{scheduler: make(chan string)} printer := new(bytes.Buffer)