changeset 8175:c8cb471fc9c2

ui.isatty() accesses sys.stdin, causing mod_wsgi to throw IOError.
author Benjamin Wohlwend <bw@piquadrat.ch>
date Sun, 26 Apr 2009 13:36:08 -0700
parents 29bc5d18714a
children 2660e7002413
files mercurial/ui.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Apr 24 18:17:42 2009 +0200
+++ b/mercurial/ui.py	Sun Apr 26 13:36:08 2009 -0700
@@ -50,6 +50,9 @@
                 ui._isatty = sys.stdin.isatty()
             except AttributeError: # not a real file object
                 ui._isatty = False
+            except IOError:
+                # access to stdin is unsafe in a WSGI environment
+                ui._isatty = False
         return ui._isatty
 
     def _is_trusted(self, fp, f):