diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-04-22 09:00:31 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-04-22 09:00:31 +0000 |
| commit | 10e512f14f29bbbe3fb34eb4ce6292b201341060 (patch) | |
| tree | 362c00d740fb4b828b1b34b26600f3623283c09b | |
| parent | generate-alt-random: wait for SIGWINCH if width/height is 0 (diff) | |
generate-alt-random: do ioctl(TIOCGWINSZ) on /dev/tty, not stdout
| -rwxr-xr-x | scripts/generate-alt-random-writes.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/generate-alt-random-writes.py b/scripts/generate-alt-random-writes.py index 8db3401b..df053844 100755 --- a/scripts/generate-alt-random-writes.py +++ b/scripts/generate-alt-random-writes.py @@ -45,11 +45,12 @@ def main(): signal.signal(signal.SIGWINCH, dummy) while True: - lines, cols, height, width = struct.unpack( - 'HHHH', - fcntl.ioctl(sys.stdout.fileno(), - termios.TIOCGWINSZ, - struct.pack('HHHH', 0, 0, 0, 0))) + with open('/dev/tty', 'rb') as pty: + lines, cols, height, width = struct.unpack( + 'HHHH', + fcntl.ioctl(pty, + termios.TIOCGWINSZ, + struct.pack('HHHH', 0, 0, 0, 0))) if width > 0 and height > 0: break |
