mercurial/ui.py
changeset 6303 577a7da1d44b
parent 6302 8e3dc3de7e73
child 6309 7240204121af
--- 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"))