mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-14 09:36:24 -04:00
Add test showing StartPty fails on Windows when given a zero size
CreatePseudoConsole rejects zero dimensions with E_INVALIDARG, so starting a pty sized after a hidden (and thus zero-sized) view fails. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
f000ce9f1c
commit
c217084c90
28
pkg/commands/oscommands/pty_windows_test.go
Normal file
28
pkg/commands/oscommands/pty_windows_test.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package oscommands
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// The requested size can legitimately be zero: the pty inherits the main
|
||||
// view's dimensions, and that view is zero-sized while hidden, e.g. in
|
||||
// full-screen mode with a side panel focused.
|
||||
func TestStartPtyWithZeroSize(t *testing.T) {
|
||||
// The command deliberately produces no output: go test runs with
|
||||
// redirected std handles, which CreateProcess duplicates into the child
|
||||
// in place of handles to the attached pseudoconsole, so command output
|
||||
// would bypass the pty and pollute the test log.
|
||||
sp, err := StartPty(exec.Command("cmd", "/c", "exit 0"), 0, 0)
|
||||
/* EXPECTED:
|
||||
assert.NoError(t, err)
|
||||
ACTUAL: */
|
||||
assert.Error(t, err)
|
||||
|
||||
if err == nil {
|
||||
_ = sp.Wait()
|
||||
_ = sp.Pty.Close()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue