ring-builder: Abort cleanly on ^C, ^D

Change-Id: If8fbcaff8e5676accb10e6c3c49387bc0de0cdb9
This commit is contained in:
Tim Burke 2022-10-16 21:58:36 -07:00
parent 57ce156a7f
commit f264b53a2e
1 changed files with 5 additions and 1 deletions

View File

@ -194,7 +194,11 @@ def check_devs(devs, input_question, opts, abort_msg):
print('Matched more than one device:')
for dev in devs:
print(' %s' % format_device(dev))
if not opts.yes and input(input_question) != 'y':
try:
abort = not opts.yes and input(input_question) != 'y'
except (EOFError, KeyboardInterrupt):
abort = True
if abort:
print(abort_msg)
exit(EXIT_ERROR)