Adjusted wk.std.input_text() again

* Dropped tcflush usage for simplicity
* Readded the prompt usage from 564745f03b
This commit is contained in:
2Shirt 2019-12-26 17:00:41 -07:00
parent 20ffa0c6db
commit c083a124ad
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -19,13 +19,6 @@ from collections import OrderedDict
import requests
try:
from termios import tcflush, TCIOFLUSH
except ImportError:
if os.name == 'posix':
# Not worried about this under Windows
raise
from wk.cfg.main import (
ENABLED_UPLOAD_DATA,
INDENT,
@ -820,13 +813,11 @@ def input_text(prompt='Enter text'):
response = None
if prompt[-1:] != ' ':
prompt += ' '
print(prompt, end='', flush=True)
while response is None:
if os.name == 'posix':
# Flush input to (hopefully) avoid EOFError
tcflush(sys.stdin, TCIOFLUSH)
try:
response = input(prompt)
response = input()
LOG.debug('%s%s', prompt, response)
except EOFError:
# Ignore and try again