diff options
author | Paul Barker <paul.barker@sancloud.com> | 2021-09-08 14:38:02 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-09-24 21:30:46 +0300 |
commit | 0d60e5d8e9a7abc46751664a0857c66280d43d2c (patch) | |
tree | 322415a51585845a0b9d44f0823686852185a3db /tools/patman | |
parent | 5fe50f9a4018f21d36e3ef34d7af9f7b5d7016b9 (diff) | |
download | u-boot-0d60e5d8e9a7abc46751664a0857c66280d43d2c.tar.xz |
tools: Handle PAGER containing arguments
When printing full help output from a tool, we should be able to handle
a PAGER variable which includes arguments, e.g. PAGER='less -F'.
Signed-off-by: Paul Barker <paul.barker@sancloud.com>
Diffstat (limited to 'tools/patman')
-rw-r--r-- | tools/patman/tools.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/patman/tools.py b/tools/patman/tools.py index 96882264a2..710f1fdcd3 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -5,6 +5,7 @@ import glob import os +import shlex import shutil import struct import sys @@ -588,9 +589,10 @@ def PrintFullHelp(fname): Args: fname: Path to a file containing the full help message """ - pager = os.getenv('PAGER') + pager = shlex.split(os.getenv('PAGER', '')) if not pager: - pager = shutil.which('less') + lesspath = shutil.which('less') + pager = [lesspath] if lesspath else None if not pager: - pager = 'more' - command.Run(pager, fname) + pager = ['more'] + command.Run(*pager, fname) |