From 43a63f5aab95bf5fdfc4bce70286802854f7a07a Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 28 Sep 2026 15:23:15 +0100 Subject: Size the checks' terminals before the program starts The live terminal checks forked a pty, started Vega's TUI, and only then set the window size and sent SIGWINCH. A TUI that read the size first drew its opening frames at the pty's default size, and replaying them into the smaller screen failed now and then (one run in about eleven). The child now sets the size on its own terminal before it starts. --- tests/check.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/check.py b/tests/check.py index 116121d..b63a728 100644 --- a/tests/check.py +++ b/tests/check.py @@ -639,9 +639,9 @@ def timing(vega, module): # The terminal, on the clock: start it, and a second and more later it shows that. pid, fd = pty.fork() if pid == 0: + # the size before the program starts: set after, its first frames could be drawn at the pty's default + fcntl.ioctl(0, termios.TIOCSWINSZ, struct.pack('HHHH', 8, 30, 0, 0)) os.execv(str(vega), [str(vega), 'tui', str(module)]) - fcntl.ioctl(fd, termios.TIOCSWINSZ, struct.pack('HHHH', 8, 30, 0, 0)) - os.kill(pid, 28) screen = b'' def read_for(seconds): @@ -769,10 +769,9 @@ def interactive(vega, module, store=None, replace=None): import fcntl, pty, select, struct, termios, time pid, fd = pty.fork() if pid == 0: + fcntl.ioctl(0, termios.TIOCSWINSZ, struct.pack('HHHH', 10, 40, 0, 0)) # before it starts: no race os.execv(str(vega), [str(vega), 'tui', str(module)] + (['--store', str(store)] if store else []) + (['--watch'] if replace else [])) - fcntl.ioctl(fd, termios.TIOCSWINSZ, struct.pack('HHHH', 10, 40, 0, 0)) - os.kill(pid, 28) # SIGWINCH: take the size def read_for(seconds): data, end = b'', time.time() + seconds -- cgit v1.2.3