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

Jeremy White jwhite at codeweavers.com
Sun Oct 20 17:13:39 CEST 2013


ACK series

On 10/20/2013 08:34 AM, Alon Levy wrote:
> 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:
>



More information about the Spice-devel mailing list