diff options
author | Jeff Quast <contact@jeffquast.com> | 2015-09-20 19:43:31 -0700 |
---|---|---|
committer | Jeff Quast <contact@jeffquast.com> | 2015-09-20 19:43:31 -0700 |
commit | b6e25ba148a4ffdf5ba0e4ba61aa78f449773cca (patch) | |
tree | ba2eec8a8bd1df7f0b21115f8ae8896db9ad364c /tests/getch.py | |
parent | 7f046a6cf86d8f60a6cf23c40ef625e5acbc1a32 (diff) | |
parent | f5993888e092bd8cecc98ac9558700d4fe8624cf (diff) | |
download | pexpect-git-document-blocking-write.tar.gz |
Merge remote-tracking branch 'origin/master' into document-blocking-writedocument-blocking-write
Diffstat (limited to 'tests/getch.py')
-rwxr-xr-x | tests/getch.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/getch.py b/tests/getch.py index 41e3224..a362e52 100755 --- a/tests/getch.py +++ b/tests/getch.py @@ -18,6 +18,7 @@ PEXPECT LICENSE OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ''' +from __future__ import print_function import sys, tty, termios if hasattr(sys.stdin, 'buffer'): @@ -27,13 +28,13 @@ else: stdin = sys.stdin def main(): - print('READY') + print('READY', end='\r\n') while True: try: val = ord(stdin.read(1)) except KeyboardInterrupt: val = 3 - sys.stdout.write('%d<STOP>\r\n' % (val,)) + print('%d<STOP>' % (val,), end='\r\n') if val == 0: # StopIteration equivalent is ctrl+' ' (\x00, NUL) break @@ -46,3 +47,4 @@ if __name__ == '__main__': main() finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) + sys.stdout.flush() |