Adjusted wk.std.input_text()
* Should hopefully reduce the duplicate prompts
This commit is contained in:
parent
56a99a8a4e
commit
564745f03b
1 changed files with 5 additions and 3 deletions
|
|
@ -785,18 +785,20 @@ def input_text(prompt='Enter text'):
|
||||||
response = None
|
response = None
|
||||||
if prompt[-1:] != ' ':
|
if prompt[-1:] != ' ':
|
||||||
prompt += ' '
|
prompt += ' '
|
||||||
|
print(prompt, end='', flush=True)
|
||||||
|
|
||||||
while response is None:
|
while response is None:
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
# Flush input to (hopefully) avoid EOFError
|
# Flush input to (hopefully) avoid EOFError
|
||||||
tcflush(sys.stdin, TCIOFLUSH)
|
tcflush(sys.stdin, TCIOFLUSH)
|
||||||
try:
|
try:
|
||||||
response = input(prompt)
|
response = input()
|
||||||
LOG.debug('%s%s', prompt, response)
|
LOG.debug('%s%s', prompt, response)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
# Ignore and try again
|
# Ignore and try again
|
||||||
LOG.warning('Exception occured', exc_info=True)
|
#LOG.warning('Exception occured', exc_info=True)
|
||||||
print('', flush=True)
|
#print('', end='', flush=True)
|
||||||
|
pass
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue