Avoid rare crash

This commit is contained in:
2Shirt 2019-01-08 15:11:34 -07:00
parent 1e5f72f79a
commit 23a88401b7
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -102,7 +102,12 @@ def ask(prompt='Kotaero!'):
answer = None
prompt = '{} [Y/N]: '.format(prompt)
while answer is None:
tmp = input(prompt)
try:
tmp = input(prompt)
except EOFError:
# Just try again?
sleep(1)
tmp = input(prompt)
if re.search(r'^y(es|)$', tmp, re.IGNORECASE):
answer = True
elif re.search(r'^n(o|ope|)$', tmp, re.IGNORECASE):
@ -412,7 +417,12 @@ def non_clobber_rename(full_path):
def pause(prompt='Press Enter to continue... '):
"""Simple pause implementation."""
input(prompt)
try:
input(prompt)
except EOFError:
# Just try again?
sleep(1)
input(prompt)
def ping(addr='google.com'):