1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 10:11:17 +00:00

Fixes for Emacs

- Do not try to use a pager if it explicitly disabled with PAGER='' in
  the environment.
- If terminal size is identified as (0, 0), fall back to default (80,
  25).
This commit is contained in:
Sergei Trofimov 2015-06-01 10:05:23 +01:00
parent 777003ed51
commit f49287cf09
2 changed files with 5 additions and 6 deletions

View File

@ -523,9 +523,9 @@ def load_class(classpath):
def get_pager():
"""Returns the name of the system pager program."""
pager = os.getenv('PAGER')
if not pager:
if pager is None:
pager = find_executable('less')
if not pager:
if pager is None:
pager = find_executable('more')
return pager

View File

@ -20,13 +20,12 @@ def get_terminal_size():
if current_os == 'Windows':
tuple_xy = _get_terminal_size_windows()
if tuple_xy is None:
# needed for window's python in cygwin's xterm
tuple_xy = _get_terminal_size_tput()
# needed for window's python in cygwin's xterm!
if current_os in ['Linux', 'Darwin'] or current_os.startswith('CYGWIN'):
tuple_xy = _get_terminal_size_linux()
if tuple_xy is None:
print "default"
tuple_xy = (80, 25) # default value
if tuple_xy is None or tuple_xy == (0, 0):
tuple_xy = (80, 25) # assume "standard" terminal
return tuple_xy