changeset 10077:89617aacb495

make ui.interactive() return false in case stdin lacks isatty
author Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
date Sun, 13 Dec 2009 18:29:16 +0100
parents 649bb75b5386
children 97c75ad3b1a0
files mercurial/ui.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Tue Dec 15 10:45:24 2009 -0600
+++ b/mercurial/ui.py	Sun Dec 13 18:29:16 2009 +0100
@@ -253,7 +253,13 @@
     def interactive(self):
         i = self.configbool("ui", "interactive", None)
         if i is None:
-            return sys.stdin.isatty()
+            try:
+                return sys.stdin.isatty()
+            except AttributeError:
+                # some environments replace stdin without implementing isatty
+                # usually those are non-interactive
+                return False
+
         return i
 
     def _readline(self, prompt=''):