changeset 6303:577a7da1d44b

two fixes for the pager stuff - open pipe in binary mode - don't start a pager if stdout is not a tty (this prevents test-ssh from hanging if you set ui.usepager=True in run-tests.py)
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Wed, 19 Mar 2008 16:54:35 -0300
parents 8e3dc3de7e73
children d99b4e8652b3
files mercurial/ui.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Tue Mar 18 22:12:34 2008 +0100
+++ b/mercurial/ui.py	Wed Mar 19 16:54:35 2008 -0300
@@ -385,7 +385,7 @@
             self.buffers[-1].extend([str(a) for a in args])
         else:
             if self.getpager() and not self.pager:
-                self.pager = os.popen(self.getpager(), "w")
+                self.pager = os.popen(self.getpager(), "wb")
                 sys.stderr = self.pager
                 sys.stdout = self.pager
             for a in args:
@@ -495,6 +495,6 @@
 
     def getpager(self):
         '''return a pager'''
-        if self.configbool("ui", "usepager", False):
+        if sys.stdout.isatty() and self.configbool("ui", "usepager", False):
             return (self.config("ui", "pager")
                     or os.environ.get("PAGER"))