/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/gui/tasks_adapter_test.go
24 строки
679 B
Stefan Haller
Never hand NewCmdTask a nil reader when a command fails to start
23 июл 2026, 18:31
23 июл 2026, 18:31
f000ce9
Код
Авторство
О чём код?
package gui import ( "bytes" "os/exec" "testing" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/stretchr/testify/assert" ) func TestStartCmdWithPipeWhenPipeCannotBeCreated(t *testing.T) { cmd := exec.Command("non-existent-command") // Assigning stdout up front makes cmd.StdoutPipe fail. This happens in // practice on the Unix pty fallback path: a failed pty start can leave // the tty assigned to the command's stdout. cmd.Stdout = &bytes.Buffer{} _, r := startCmdWithPipe(cmd, utils.NewDummyLog()) // NewCmdTask's scanner panics on a nil reader, so startCmdWithPipe must // not return one even when it can't create the pipe. assert.NotNil(t, r) }