virt-manager: Exit on ctrl-c

pygobject3 doesn't provide this automatically. Solution taken from:

https://bugzilla.gnome.org/show_bug.cgi?id=622084
This commit is contained in:
Cole Robinson 2017-06-27 11:57:24 -04:00
parent fb8db15269
commit 8fd8791139
1 changed files with 9 additions and 0 deletions

View File

@ -272,6 +272,15 @@ def main():
LibvirtGLib.init(None)
LibvirtGLib.event_register()
# Actually exit when we receive ctrl-c
from gi.repository import GLib
def _sigint_handler(user_data):
ignore = user_data
logging.debug("Received KeyboardInterrupt. Exiting application.")
sys.exit(0)
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT,
_sigint_handler, None)
engine = vmmEngine()
engine.start(options.uri, show_window, domain, options.skip_autostart)