Adjusted wk.std.input_text() again
* Dropped tcflush usage for simplicity
* Readded the prompt usage from 564745f03b
This commit is contained in:
parent
20ffa0c6db
commit
c083a124ad
1 changed files with 2 additions and 11 deletions
|
|
@ -19,13 +19,6 @@ from collections import OrderedDict
|
||||||
|
|
||||||
import requests
|
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 (
|
from wk.cfg.main import (
|
||||||
ENABLED_UPLOAD_DATA,
|
ENABLED_UPLOAD_DATA,
|
||||||
INDENT,
|
INDENT,
|
||||||
|
|
@ -820,13 +813,11 @@ 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':
|
|
||||||
# Flush input to (hopefully) avoid EOFError
|
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue