[Spice-devel] [PATCH xspice 1/2] Xspice: cleanup Xorg process on SIGTERM

Alon Levy alevy at redhat.com
Sun Oct 20 15:34:07 CEST 2013


Signed-off-by: Alon Levy <alevy at redhat.com>
---
 scripts/Xspice | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/Xspice b/scripts/Xspice
index a4eb647..17439a1 100755
--- a/scripts/Xspice
+++ b/scripts/Xspice
@@ -22,6 +22,7 @@ import sys
 import tempfile
 import atexit
 import time
+import signal
 from subprocess import Popen, PIPE
 
 def which(x):
@@ -154,7 +155,7 @@ if not args.xorg:
 cleanup_files = []
 cleanup_processes = []
 
-def cleanup():
+def cleanup(*args):
     for f in cleanup_files:
         if os.path.isfile(f):
             os.remove(f)
@@ -162,12 +163,14 @@ def cleanup():
         p.kill()
     for p in cleanup_processes:
         p.wait()
+    del cleanup_processes[:]
 
 def launch(*args, **kw):
     p = Popen(*args, **kw)
     cleanup_processes.append(p)
     return p
 
+signal.signal(signal.SIGTERM, cleanup)
 atexit.register(cleanup)
 
 if args.auto:
-- 
1.8.3.1



More information about the Spice-devel mailing list