Skip to content

Commit e76ad95

Browse files
committed
Move console cleanup to shared place
1 parent f556c26 commit e76ad95

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cli/clitest/clitest.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ func NewConsole(t *testing.T, cmd *cobra.Command) *expect.Console {
7575

7676
console, err := expect.NewConsole(expect.WithStdout(writer))
7777
require.NoError(t, err)
78+
t.Cleanup(func() {
79+
console.Close()
80+
})
7881
cmd.SetIn(console.InTty())
7982
cmd.SetOut(console.OutTty())
8083
return console

cli/clitest/clitest_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ func TestCli(t *testing.T) {
2020
cmd, config := clitest.New(t)
2121
clitest.SetupConfig(t, client, config)
2222
console := clitest.NewConsole(t, cmd)
23-
t.Cleanup(func () {
24-
console.Close()
25-
})
2623
go func() {
2724
err := cmd.Execute()
2825
require.NoError(t, err)

0 commit comments

Comments
 (0)