mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
ubuntutools.question: Catch EOF and SIGINT on all input and bail out.
(LP: #1037488)
This commit is contained in:
parent
e30a6e51a7
commit
73461fca08
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -17,6 +17,8 @@ ubuntu-dev-tools (0.144) UNRELEASED; urgency=low
|
||||
- Explain that backports aren't to fix bugs.
|
||||
* sponsor-patch: Don't fall over bugs targetted at the development release
|
||||
(LP: #936014)
|
||||
* ubuntutools.question: Catch EOF and SIGINT on all input and bail out.
|
||||
(LP: #1037488)
|
||||
|
||||
[ Benjamin Drung ]
|
||||
* seeded-in-ubuntu: State in error message that it takes a source package.
|
||||
|
@ -55,7 +55,11 @@ class Question(object):
|
||||
|
||||
selected = None
|
||||
while selected not in self.options:
|
||||
try:
|
||||
selected = raw_input(question).strip().lower()
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
print '\nAborting as requested.'
|
||||
sys.exit(1)
|
||||
if selected == "":
|
||||
selected = default
|
||||
else:
|
||||
@ -81,7 +85,11 @@ def input_number(question, min_number, max_number, default=None):
|
||||
question += "? "
|
||||
selected = None
|
||||
while selected < min_number or selected > max_number:
|
||||
try:
|
||||
selected = raw_input(question).strip()
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
print '\nAborting as requested.'
|
||||
sys.exit(1)
|
||||
if default and selected == "":
|
||||
selected = default
|
||||
else:
|
||||
@ -106,7 +114,7 @@ def confirmation_prompt(message=None, action=None):
|
||||
message = 'Press [Enter] to %s. Press [Ctrl-C] to abort now.' % action
|
||||
try:
|
||||
raw_input(message)
|
||||
except KeyboardInterrupt:
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
print '\nAborting as requested.'
|
||||
sys.exit(1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user