Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 36842:1527f40de3b3
ui: remove any combinations of CR|LF from prompt response
On Windows, we have to accept both CR+LF and LF. This patch simply makes
any trailing CRs and LFs removed from a user input instead of doing stricter
parsing, as an input must be a readable text.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 10 Mar 2018 15:50:09 +0900 |
parents | aa0fc12743c7 |
children | 98487ad0cf8b |
comparison
equal
deleted
inserted
replaced
36841:46f4d71ed505 | 36842:1527f40de3b3 |
---|---|
1294 self.fout.write(b' ') | 1294 self.fout.write(b' ') |
1295 self.fout.flush() | 1295 self.fout.flush() |
1296 line = self.fin.readline() | 1296 line = self.fin.readline() |
1297 if not line: | 1297 if not line: |
1298 raise EOFError | 1298 raise EOFError |
1299 if line.endswith(pycompat.oslinesep): | 1299 line = line.rstrip(pycompat.oslinesep) |
1300 line = line[:-len(pycompat.oslinesep)] | |
1301 | 1300 |
1302 return line | 1301 return line |
1303 | 1302 |
1304 def prompt(self, msg, default="y"): | 1303 def prompt(self, msg, default="y"): |
1305 """Prompt user with msg, read response. | 1304 """Prompt user with msg, read response. |