diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-08 14:05:26 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-08 14:05:26 -0400 |
commit | a425e19c6a93dc7e6b0a5f13f335de9f6a5e348e (patch) | |
tree | 45a5f052b45286d2e14b7074843c4e9124f49b6c /cmd2.py | |
parent | a140ad1cdb531d2bc60237502cf8601f46d60692 (diff) | |
download | cmd2-git-a425e19c6a93dc7e6b0a5f13f335de9f6a5e348e.tar.gz |
Added a few more unit tests
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -878,20 +878,23 @@ class Cmd(cmd.Cmd): def pseudo_raw_input(self, prompt): """copied from cmd's cmdloop; like raw_input, but accounts for changed stdin, stdout""" + # Deal with the vagaries of readline and ANSI escape codes + safe_prompt = self._surround_ansi_escapes(prompt) + if self.use_rawinput: - safe_prompt = self._surround_ansi_escapes(prompt) try: line = sm.input(safe_prompt) except EOFError: line = 'EOF' else: - self.stdout.write(prompt) + self.stdout.write(safe_prompt) self.stdout.flush() line = self.stdin.readline() if not len(line): line = 'EOF' else: line = line.rstrip('\r\n') + return line.strip() def _cmdloop(self): @@ -942,7 +945,7 @@ class Cmd(cmd.Cmd): # Need to set empty list this way because Python 2 doesn't support the clear() method on lists self.cmdqueue = [] self._script_dir = [] - + return stop # noinspection PyUnusedLocal |