[kupfer] Catch early SIGINT and terminate immediately
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] Catch early SIGINT and terminate immediately
- Date: Sun, 9 May 2010 15:55:23 +0000 (UTC)
commit 4f338b8c18d6af1ba2e1b7ae1193f666004dca15
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sun May 9 16:25:25 2010 +0100
Catch early SIGINT and terminate immediately
First bind an early interrupt handler that simply terminates kupfer.
This will stop kupfer if it is interrupted before it is loaded
properly.
kupfer/ui/browser.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index f3a6f63..724cd0a 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -3,6 +3,8 @@
import itertools
import os
+import signal
+import sys
import time
import pygtk
@@ -1577,6 +1579,9 @@ class WindowController (pretty.OutputMixin):
self.output_info("Caught signal", signal, "exiting..")
self.quit()
+ def _on_early_interrupt(self, signal, frame):
+ sys.exit(1)
+
def save_data(self):
"""Save state before quit"""
sch = scheduler.GetScheduler()
@@ -1610,7 +1615,6 @@ class WindowController (pretty.OutputMixin):
Connect to desktop services (keybinding callback, session logout
callbacks etc).
"""
- import signal
from kupfer.ui import session
self.output_debug("in lazy_setup")
@@ -1646,6 +1650,7 @@ class WindowController (pretty.OutputMixin):
def main(self, quiet=False):
"""Start WindowController, present its window (if not @quiet)"""
+ signal.signal(signal.SIGINT, self._on_early_interrupt)
try:
kserv = listen.Service()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]