mercurial/ui.py
changeset 14515 76f295eaed86
parent 14373 a599431b0ab6
child 14612 4e1ccd4c2b6d
--- a/mercurial/ui.py	Thu Jun 02 18:52:31 2011 +0800
+++ b/mercurial/ui.py	Thu Jun 02 00:43:34 2011 +0300
@@ -473,12 +473,9 @@
         '''
         i = self.configbool("ui", "interactive", None)
         if i is None:
-            try:
-                return sys.stdin.isatty()
-            except AttributeError:
-                # some environments replace stdin without implementing isatty
-                # usually those are non-interactive
-                return False
+            # some environments replace stdin without implementing isatty
+            # usually those are non-interactive
+            return util.isatty(sys.stdin)
 
         return i
 
@@ -514,17 +511,14 @@
 
         i = self.configbool("ui", "formatted", None)
         if i is None:
-            try:
-                return sys.stdout.isatty()
-            except AttributeError:
-                # some environments replace stdout without implementing isatty
-                # usually those are non-interactive
-                return False
+            # some environments replace stdout without implementing isatty
+            # usually those are non-interactive
+            return util.isatty(sys.stdout)
 
         return i
 
     def _readline(self, prompt=''):
-        if sys.stdin.isatty():
+        if util.isatty(sys.stdin):
             try:
                 # magically add command line editing support, where
                 # available