mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
generate-alt-random: do ioctl(TIOCGWINSZ) on /dev/tty, not stdout
This commit is contained in:
parent
44b8bd2364
commit
10e512f14f
1 changed files with 6 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue