mercurial/ui.py
changeset 36794 fa53a1d1f16e
parent 36791 30742c216abb
child 36795 9b513888ea23
equal deleted inserted replaced
36793:eca1051e6c22 36794:fa53a1d1f16e
  1262             return self._isatty(self.fout)
  1262             return self._isatty(self.fout)
  1263 
  1263 
  1264         return i
  1264         return i
  1265 
  1265 
  1266     def _readline(self):
  1266     def _readline(self):
  1267         if self._isatty(self.fin):
  1267         usereadline = (self._isatty(self.fin) and self._isatty(self.fout)
       
  1268                        and util.isstdin(self.fin) and util.isstdout(self.fout))
       
  1269         if usereadline:
  1268             try:
  1270             try:
  1269                 # magically add command line editing support, where
  1271                 # magically add command line editing support, where
  1270                 # available
  1272                 # available
  1271                 import readline
  1273                 import readline
  1272                 # force demandimport to really load the module
  1274                 # force demandimport to really load the module
  1273                 readline.read_history_file
  1275                 readline.read_history_file
  1274                 # windows sometimes raises something other than ImportError
  1276                 # windows sometimes raises something other than ImportError
  1275             except Exception:
  1277             except Exception:
  1276                 pass
  1278                 usereadline = False
  1277 
  1279 
  1278         # prompt ' ' must exist; otherwise readline may delete entire line
  1280         # prompt ' ' must exist; otherwise readline may delete entire line
  1279         # - http://bugs.python.org/issue12833
  1281         # - http://bugs.python.org/issue12833
  1280         with self.timeblockedsection('stdio'):
  1282         with self.timeblockedsection('stdio'):
  1281             sin, sout = sys.stdin, sys.stdout
  1283             sin, sout = sys.stdin, sys.stdout