mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 11:48:13 +01:00
Use os.get_terminal_size()
tput is part of ncurses, which may not be installed. It still falls back to tput for older Python versions (this was introduced in 3.3) or for platforms which may not support it. Fixes #418
This commit is contained in:
committed by
Marcin Kulik
parent
d6557c76ef
commit
80c9d3dbdc
@@ -33,8 +33,10 @@ def read_blocking(fd, timeout):
|
||||
|
||||
|
||||
def get_size():
|
||||
# TODO maybe use os.get_terminal_size ?
|
||||
return (
|
||||
int(subprocess.check_output(['tput', 'cols'])),
|
||||
int(subprocess.check_output(['tput', 'lines']))
|
||||
)
|
||||
try:
|
||||
return os.get_terminal_size()
|
||||
except:
|
||||
return (
|
||||
int(subprocess.check_output(['tput', 'cols'])),
|
||||
int(subprocess.check_output(['tput', 'lines']))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user