aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPaul Barker2021-09-08 12:38:02 +0100
committerTom Rini2021-09-24 14:30:46 -0400
commit0d60e5d8e9a7abc46751664a0857c66280d43d2c (patch)
tree322415a51585845a0b9d44f0823686852185a3db /tools
parent5fe50f9a4018f21d36e3ef34d7af9f7b5d7016b9 (diff)
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')
-rw-r--r--tools/patman/tools.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 96882264a2f..710f1fdcd36 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)