mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
show command: handle bad PAGER
If show command finds a PAGER defined in the user's environment but is unable to use it, fall back to dumping output directly to STDOUT.
This commit is contained in:
parent
57972a56af
commit
6ccca6d4c0
@ -48,10 +48,15 @@ class ShowCommand(Command):
|
|||||||
text = out.getvalue()
|
text = out.getvalue()
|
||||||
pager = get_pager()
|
pager = get_pager()
|
||||||
if len(text.split('\n')) > term_height and pager:
|
if len(text.split('\n')) > term_height and pager:
|
||||||
sp = subprocess.Popen(pager, stdin=subprocess.PIPE)
|
try:
|
||||||
sp.communicate(text)
|
sp = subprocess.Popen(pager, stdin=subprocess.PIPE)
|
||||||
|
sp.communicate(text)
|
||||||
|
except OSError:
|
||||||
|
self.logger.warning('Could not use PAGER "{}"'.format(pager))
|
||||||
|
sys.stdout.write(text)
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(text)
|
sys.stdout.write(text)
|
||||||
|
sys.stdout.write(text)
|
||||||
|
|
||||||
|
|
||||||
def format_extension(extension, out, width):
|
def format_extension(extension, out, width):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user