diff options
author | Tim Burke <tim.burke@gmail.com> | 2022-10-16 21:58:36 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2023-04-10 14:29:20 -0700 |
commit | f264b53a2ed8146738d74d1bbe5c1bd679661b16 (patch) | |
tree | ad2ccc1b8539428fdbafc4d64e810fc1e8737083 | |
parent | 57ce156a7f5cecd58fb4d83acbe1416d583275d1 (diff) | |
download | swift-f264b53a2ed8146738d74d1bbe5c1bd679661b16.tar.gz |
ring-builder: Abort cleanly on ^C, ^D
Change-Id: If8fbcaff8e5676accb10e6c3c49387bc0de0cdb9
-rw-r--r-- | swift/cli/ringbuilder.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/swift/cli/ringbuilder.py b/swift/cli/ringbuilder.py index 001919d52..62b956023 100644 --- a/swift/cli/ringbuilder.py +++ b/swift/cli/ringbuilder.py @@ -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) |