mercurial/ui.py
branchstable
changeset 15000 68b5d7005cca
parent 14738 bcc1a9fd0b8c
child 15002 b55c1c6a793e
child 15053 17ffb30d9174
equal deleted inserted replaced
14998:a5d449fc5e07 15000:68b5d7005cca
   535                 readline.read_history_file
   535                 readline.read_history_file
   536                 # windows sometimes raises something other than ImportError
   536                 # windows sometimes raises something other than ImportError
   537             except Exception:
   537             except Exception:
   538                 pass
   538                 pass
   539 
   539 
   540         # instead of trying to emulate raw_input, swap our in/out
   540         # call write() so output goes through subclassed implementation
   541         # with sys.stdin/out
   541         # e.g. color extension on Windows
   542         old = sys.stdout, sys.stdin
   542         self.write(prompt)
   543         sys.stdout, sys.stdin = self.fout, self.fin
   543 
   544         line = raw_input(prompt)
   544         # instead of trying to emulate raw_input, swap self.fin with sys.stdin
   545         sys.stdout, sys.stdin = old
   545         old = sys.stdin
       
   546         sys.stdin = self.fin
       
   547         line = raw_input()
       
   548         sys.stdin = old
   546 
   549 
   547         # When stdin is in binary mode on Windows, it can cause
   550         # When stdin is in binary mode on Windows, it can cause
   548         # raw_input() to emit an extra trailing carriage return
   551         # raw_input() to emit an extra trailing carriage return
   549         if os.linesep == '\r\n' and line and line[-1] == '\r':
   552         if os.linesep == '\r\n' and line and line[-1] == '\r':
   550             line = line[:-1]
   553             line = line[:-1]