From ee7b634dced182e76ab83f9d025001f506e6b59e Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 5 Apr 2021 13:07:25 +1000 Subject: [PATCH] how about using pty --- pkg/gui/gui_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/gui/gui_test.go b/pkg/gui/gui_test.go index d6e2e12bc..938765caf 100644 --- a/pkg/gui/gui_test.go +++ b/pkg/gui/gui_test.go @@ -3,6 +3,7 @@ package gui import ( "encoding/json" "fmt" + "io" "io/ioutil" "os" "path/filepath" @@ -10,6 +11,7 @@ import ( "strings" "testing" + "github.com/creack/pty" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/secureexec" "github.com/stretchr/testify/assert" @@ -315,8 +317,14 @@ func runLazygit(t *testing.T, testPath string, rootDir string, configDir string, "TERM=xterm", ) - err = cmd.Run() + f, err := pty.StartWithSize(cmd, &pty.Winsize{Rows: 100, Cols: 100}) assert.NoError(t, err) + + _, _ = io.Copy(ioutil.Discard, f) + + assert.NoError(t, err) + + _ = f.Close() } func prepareIntegrationTestDir(actualDir string) {