[PATCH 2 of 2 stable] util.termwidth: check stderr first as it's least likely to be redirected

Augie Fackler durin42 at gmail.com
Tue Mar 30 09:44:27 CDT 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1268682814 18000
# Node ID 3d633dbc97c39c1968dd83c630a7ccdbfde4f55b
# Parent  635531cd513c96442210c6e2bf9bb707047f22c8
util.termwidth: check stderr first as it's least likely to be redirected

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1260,7 +1260,7 @@
             pass
     try:
         import termios, array, fcntl
-        for dev in (sys.stdout, sys.stdin):
+        for dev in (sys.stderr, sys.stdout, sys.stdin):
             try:
                 try:
                     fd = dev.fileno()


More information about the Mercurial-devel mailing list