mercurial/ui.py
changeset 5613 2e76e5a23c2b
parent 5337 8c5ef3b87cb1
child 5660 3c80ecdc1bcd
equal deleted inserted replaced
5612:7c976bb039af 5613:2e76e5a23c2b
   401                 import readline
   401                 import readline
   402                 # force demandimport to really load the module
   402                 # force demandimport to really load the module
   403                 readline.read_history_file
   403                 readline.read_history_file
   404             except ImportError:
   404             except ImportError:
   405                 pass
   405                 pass
   406         return raw_input(prompt)
   406         line = raw_input(prompt)
       
   407         # When stdin is in binary mode on Windows, it can cause
       
   408         # raw_input() to emit an extra trailing carriage return
       
   409         if os.linesep == '\r\n' and line and line[-1] == '\r':
       
   410             line = line[:-1]
       
   411         return line
   407 
   412 
   408     def prompt(self, msg, pat=None, default="y", matchflags=0):
   413     def prompt(self, msg, pat=None, default="y", matchflags=0):
   409         if not self.interactive: return default
   414         if not self.interactive: return default
   410         try:
   415         try:
   411             r = self._readline(msg + ' ')
   416             r = self._readline(msg + ' ')