Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 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 | 38170eeed18c |
children | 489b0caf21ed |
comparison
equal
deleted
inserted
replaced
10076:649bb75b5386 | 10077:89617aacb495 |
---|---|
251 except: pass | 251 except: pass |
252 | 252 |
253 def interactive(self): | 253 def interactive(self): |
254 i = self.configbool("ui", "interactive", None) | 254 i = self.configbool("ui", "interactive", None) |
255 if i is None: | 255 if i is None: |
256 return sys.stdin.isatty() | 256 try: |
257 return sys.stdin.isatty() | |
258 except AttributeError: | |
259 # some environments replace stdin without implementing isatty | |
260 # usually those are non-interactive | |
261 return False | |
262 | |
257 return i | 263 return i |
258 | 264 |
259 def _readline(self, prompt=''): | 265 def _readline(self, prompt=''): |
260 if sys.stdin.isatty(): | 266 if sys.stdin.isatty(): |
261 try: | 267 try: |