[PATCH] patman: Handle PAGER containing arguments

Paul Barker paul.barker at sancloud.com
Tue Jun 15 12:25:22 CEST 2021


When printing full help output from patman, we should be able to handle
a PAGER variable which includes arguments, e.g. PAGER='less -F'.

Signed-off-by: Paul Barker <paul.barker at sancloud.com>
---

 tools/patman/main.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/patman/main.py b/tools/patman/main.py
index 04e37a5931..4d6f195b7c 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -9,6 +9,7 @@
 from argparse import ArgumentParser
 import os
 import re
+import shlex
 import shutil
 import sys
 import traceback
@@ -170,14 +171,14 @@ elif args.cmd == 'send':
         fd.close()
 
     elif args.full_help:
-        pager = os.getenv('PAGER')
+        pager = shlex.split(os.getenv('PAGER'))
         if not pager:
-            pager = shutil.which('less')
+            pager = [shutil.which('less')]
         if not pager:
-            pager = 'more'
+            pager = ['more']
         fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
                              'README')
-        command.Run(pager, fname)
+        command.Run(*pager, fname)
 
     else:
         # If we are not processing tags, no need to warning about bad ones
-- 
2.26.2



More information about the U-Boot mailing list