changeset 25201:59d794154e8d

pager: drop python 2.4 hack around subprocess Farewell, we do not need you anymore.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 18 May 2015 16:20:12 -0500
parents 3613819fb05f
children a363c058872a
files hgext/pager.py
diffstat 1 files changed, 2 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/pager.py	Mon May 18 16:18:18 2015 -0500
+++ b/hgext/pager.py	Mon May 18 16:20:12 2015 -0500
@@ -55,7 +55,7 @@
 
 '''
 
-import atexit, sys, os, signal, subprocess, errno, shlex
+import atexit, sys, os, signal, subprocess
 from mercurial import commands, dispatch, util, extensions, cmdutil
 from mercurial.i18n import _
 
@@ -65,34 +65,6 @@
 # leave the attribute unspecified.
 testedwith = 'internal'
 
-def _pagerfork(ui, p):
-    if not util.safehasattr(os, 'fork'):
-        sys.stdout = util.popen(p, 'wb')
-        if ui._isatty(sys.stderr):
-            sys.stderr = sys.stdout
-        return
-    fdin, fdout = os.pipe()
-    pid = os.fork()
-    if pid == 0:
-        os.close(fdin)
-        os.dup2(fdout, sys.stdout.fileno())
-        if ui._isatty(sys.stderr):
-            os.dup2(fdout, sys.stderr.fileno())
-        os.close(fdout)
-        return
-    os.dup2(fdin, sys.stdin.fileno())
-    os.close(fdin)
-    os.close(fdout)
-    try:
-        os.execvp('/bin/sh', ['/bin/sh', '-c', p])
-    except OSError, e:
-        if e.errno == errno.ENOENT:
-            # no /bin/sh, try executing the pager directly
-            args = shlex.split(p)
-            os.execvp(args[0], args)
-        else:
-            raise
-
 def _pagersubprocess(ui, p):
     pager = subprocess.Popen(p, shell=True, bufsize=-1,
                              close_fds=util.closefds, stdin=subprocess.PIPE,
@@ -114,13 +86,7 @@
         pager.wait()
 
 def _runpager(ui, p):
-    # The subprocess module shipped with Python <= 2.4 is buggy (issue3533).
-    # The compat version is buggy on Windows (issue3225), but has been shipping
-    # with hg for a long time.  Preserve existing functionality.
-    if sys.version_info >= (2, 5):
-        _pagersubprocess(ui, p)
-    else:
-        _pagerfork(ui, p)
+    _pagersubprocess(ui, p)
 
 def uisetup(ui):
     if '--debugger' in sys.argv or not ui.formatted():