Fix icat fail on mac with --print-window-size
passing tty as TextIOWrapper to screen_size_function results in a TypeError since the screen_size_function expects an int. calling fileno() on tty gives us the desired int. This also fixes the kitty matplotlib backend, if MPLBACEND_KITTY_SIZING is not set to manual
This commit is contained in:
parent
14e0b01b40
commit
c8a258f36b
@ -515,7 +515,12 @@ def main(args: List[str] = sys.argv) -> None:
|
|||||||
if cli_opts.print_window_size:
|
if cli_opts.print_window_size:
|
||||||
screen_size_function.cache_clear()
|
screen_size_function.cache_clear()
|
||||||
with open(os.ctermid()) as tty:
|
with open(os.ctermid()) as tty:
|
||||||
ss = screen_size_function(tty)()
|
try:
|
||||||
|
fd = tty.fileno()
|
||||||
|
except AttributeError:
|
||||||
|
# use default value for fd if ctermid is not available
|
||||||
|
fd = None
|
||||||
|
ss = screen_size_function(fd)()
|
||||||
print(f'{ss.width}x{ss.height}', end='')
|
print(f'{ss.width}x{ss.height}', end='')
|
||||||
raise SystemExit(0)
|
raise SystemExit(0)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user