Fix user interrupt

This commit is contained in:
Dimitris Zlatanidis 2015-08-06 15:36:23 +03:00
parent 9c0ff33436
commit f0b23474ea
4 changed files with 16 additions and 8 deletions

View file

@ -87,7 +87,7 @@ class MetaData(object):
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (2, 6, 9)
__version_info__ = (2, 7, 0)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"

View file

@ -96,7 +96,7 @@ class PackageManager(object):
remove_pkg = raw_input(
"\nAre you sure to remove {0} {1} [y/N]? ".format(
str(len(self.removed)), msg))
except KeyboardInterrupt:
except (KeyboardInterrupt, EOFError):
print("") # new line at exit
raise SystemExit()
if remove_pkg in ["y", "Y"]:
@ -128,7 +128,7 @@ class PackageManager(object):
"\nRemove dependencies (maybe used by "
"other packages) [y/N]? ")
print("")
except KeyboardInterrupt:
except (KeyboardInterrupt, EOFError):
print("") # new line at exit
raise SystemExit()
return remove_dep
@ -207,7 +207,7 @@ class PackageManager(object):
Msg().template(78)
try:
self.skip = raw_input(" > ").split()
except KeyboardInterrupt:
except (KeyboardInterrupt, EOFError):
print("")
raise SystemExit()
for s in self.skip:
@ -345,7 +345,7 @@ class PackageManager(object):
else:
print(pkg)
print("") # new line at end
except KeyboardInterrupt:
except (KeyboardInterrupt, EOFError):
print("") # new line at exit
raise SystemExit()

View file

@ -212,8 +212,12 @@ class Patches(object):
"***{1}".format(self.meta.color["RED"],
self.meta.color["ENDC"]))
Msg().template(78)
answer = raw_input("\nThe kernel has been upgraded, "
"reinstall `LILO` [y/N]? ")
try:
answer = raw_input("\nThe kernel has been upgraded, "
"reinstall `LILO` [y/N]? ")
except (KeyboardInterrupt, EOFError):
print("")
raise SystemExit()
if answer in ["y", "Y"]:
subprocess.call("lilo", shell=True)
break

View file

@ -57,7 +57,11 @@ def it_self_update():
else:
print("\nNew version '{0}-{1}' is available !\n".format(
_meta_.__all__, __new_version__))
answer = raw_input("Would you like to upgrade [y/N]? ")
try:
answer = raw_input("Would you like to upgrade [y/N]? ")
except (KeyboardInterrupt, EOFError):
print("")
raise SystemExit()
if answer in ["y", "Y"]:
print("") # new line after answer
else: