Patchwork [4,of,5] pager: rename variables of backup fds

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 4, 2015, 6:08 a.m.
Message ID <fdf2f8de666bb352eedf.1443938885@mimosa>
Download mbox | patch
Permalink /patch/10770/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 4, 2015, 6:08 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1443865701 -32400
#      Sat Oct 03 18:48:21 2015 +0900
# Node ID fdf2f8de666bb352eedf13df7630d4499951fc39
# Parent  5d7de1415596d9cc072b0aba37a2bf05fcb99aa7
pager: rename variables of backup fds

The next patch will add backup file objects, so the original variable names
would be confusing.

Patch

diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -70,8 +70,8 @@  def _runpager(ui, p):
                              close_fds=util.closefds, stdin=subprocess.PIPE,
                              stdout=sys.stdout, stderr=sys.stderr)
 
-    stdout = os.dup(sys.stdout.fileno())
-    stderr = os.dup(sys.stderr.fileno())
+    stdoutfd = os.dup(sys.stdout.fileno())
+    stderrfd = os.dup(sys.stderr.fileno())
     os.dup2(pager.stdin.fileno(), sys.stdout.fileno())
     if ui._isatty(sys.stderr):
         os.dup2(pager.stdin.fileno(), sys.stderr.fileno())
@@ -81,8 +81,8 @@  def _runpager(ui, p):
         if util.safehasattr(signal, "SIGINT"):
             signal.signal(signal.SIGINT, signal.SIG_IGN)
         pager.stdin.close()
-        os.dup2(stdout, sys.stdout.fileno())
-        os.dup2(stderr, sys.stderr.fileno())
+        os.dup2(stdoutfd, sys.stdout.fileno())
+        os.dup2(stderrfd, sys.stderr.fileno())
         pager.wait()
 
 def uisetup(ui):