aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 15:23:15 +0100
committereunhhu <[email protected]>2026-09-28 15:23:15 +0100
commit43a63f5aab95bf5fdfc4bce70286802854f7a07a (patch)
tree5bc391fbbe31a4071ab2130a70c9d37a5c38ddee
parentbafb710f0047751e26b87897eaf2a05609708536 (diff)
downloadvega-43a63f5aab95bf5fdfc4bce70286802854f7a07a.tar.gz
vega-43a63f5aab95bf5fdfc4bce70286802854f7a07a.zip
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.
-rw-r--r--tests/check.py7
1 files 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