[Python-checkins] cpython: - Issue #8637: Honor a pager set by the env var MANPAGER (in preference to

matthias.klose python-checkins at python.org
Tue Jun 14 02:39:42 EDT 2016


https://hg.python.org/cpython/rev/820d21c97d66
changeset:   102008:820d21c97d66
user:        doko at ubuntu.com
date:        Tue Jun 14 08:39:31 2016 +0200
summary:
  - Issue #8637: Honor a pager set by the env var MANPAGER (in preference to
  one set by the env var PAGER).

files:
  Lib/pydoc.py |  3 ++-
  Misc/NEWS    |  3 +++
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1429,7 +1429,8 @@
         return plainpager
     if not sys.stdin.isatty() or not sys.stdout.isatty():
         return plainpager
-    if 'PAGER' in os.environ:
+    use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER')
+    if use_pager:
         if sys.platform == 'win32': # pipes completely broken in Windows
             return lambda text: tempfilepager(plain(text), os.environ['PAGER'])
         elif os.environ.get('TERM') in ('dumb', 'emacs'):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 Library
 -------
 
+- Issue #8637: Honor a pager set by the env var MANPAGER (in preference to
+  one set by the env var PAGER).
+
 - Issue #22636: Avoid shell injection problems with
   ctypes.util.find_library().
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list