make ui.interactive() return false in case stdin lacks isatty
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
Sun, 13 Dec 2009 18:29:16 +0100
changeset 10077 89617aacb495
parent 10076 649bb75b5386
child 10078 97c75ad3b1a0
make ui.interactive() return false in case stdin lacks isatty
mercurial/ui.py
--- 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=''):