1#----------------------------------------------------------------------------- 2# Copyright (c) 2013-2019, PyInstaller Development Team. 3# 4# Distributed under the terms of the GNU General Public License with exception 5# for distributing bootloader. 6# 7# The full license is in the file COPYING.txt, distributed with this software. 8#----------------------------------------------------------------------------- 9 10 11import sys 12 13 14print("""test_buffering - unbufferred 15 type: 123456<enter> 16 should see: 12345 17 type: <enter> 18 if unbuffered should see: 6 19 if NOT unbuffered, should see nothing 20 type: Q to quit 21 22input:""") 23# Ensure the previous message is fully printed to terminal. 24sys.stdout.flush() 25 26 27while True: 28 data = sys.stdin.read(5) 29 sys.stdout.write(data) 30 sys.stdout.flush() 31 if 'Q' in data or 'q' in data: 32 break 33 34 35print('test_buffering - done') 36