mirror of
https://github.com/novoid/filetags.git
synced 2026-06-14 11:31:19 +00:00
Merge pull request #53 from icychkn/master
Added check to avoid stty error when stdin is redirected
This commit is contained in:
commit
ca87aaf067
1 changed files with 8 additions and 4 deletions
|
|
@ -81,10 +81,14 @@ if platform.system() == 'Windows':
|
|||
TTY_HEIGHT, TTY_WIDTH = 80, 80 # fall-back values
|
||||
IS_WINDOWS = True
|
||||
else:
|
||||
try:
|
||||
TTY_HEIGHT, TTY_WIDTH = [int(x) for x in os.popen('stty size', 'r').read().split()]
|
||||
except ValueError:
|
||||
TTY_HEIGHT, TTY_WIDTH = 80, 80 # fall-back values
|
||||
# check to avoid stty error when stdin is not a terminal.
|
||||
if sys.stdin.isatty():
|
||||
try:
|
||||
TTY_HEIGHT, TTY_WIDTH = [int(x) for x in os.popen('stty size', 'r').read().split()]
|
||||
except ValueError:
|
||||
TTY_HEIGHT, TTY_WIDTH = 80, 80 # fall-back values
|
||||
else:
|
||||
TTY_HEIGHT, TTY_WIDTH = 80, 80
|
||||
|
||||
max_file_length = 0 # will be set after iterating over source files182
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue