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

Augie Fackler durin42 at gmail.com
Mon Mar 29 16:50:44 CDT 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1268682814 18000
# Node ID 2870065de9b3cb93baf75e93f4f0c56dc0fca7c3
# Parent  e31540e27fec6c54a5592f19e16c6d240ab76847
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