[Spice-devel] [PATCH xf86_video_qxl 1/2] Revise Xspice --auto to use a temporary directory.
Christophe Fergeau
cfergeau at redhat.com
Mon Nov 16 08:27:01 PST 2015
Looks good, ACK.
Christophe
On Mon, Nov 09, 2015 at 10:08:56AM -0600, Jeremy White wrote:
> We will put auto session related items in that directory.
>
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
> scripts/Xspice | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/Xspice b/scripts/Xspice
> index 7414721..5941f4f 100755
> --- a/scripts/Xspice
> +++ b/scripts/Xspice
> @@ -169,12 +169,16 @@ if not args.xorg:
> error("Xorg missing")
>
> cleanup_files = []
> +cleanup_dirs = []
> cleanup_processes = []
>
> def cleanup(*args):
> for f in cleanup_files:
> if os.path.exists(f):
> os.remove(f)
> + for d in cleanup_dirs:
> + if os.path.exists(d):
> + os.rmdir(d)
> for p in cleanup_processes:
> try:
> p.kill()
> @@ -196,10 +200,17 @@ signal.signal(signal.SIGTERM, cleanup)
> atexit.register(cleanup)
>
> if args.auto:
> - cf = tempfile.NamedTemporaryFile(prefix="Xspice-", delete=True)
> - cleanup_files.append(cf.name + ".log")
> - args.config = cf.name
> - xorg_args = [ '-logfile', cf.name + ".log" ] + xorg_args
> + temp_dir = tempfile.mkdtemp(prefix="Xspice-")
> + cleanup_dirs.append(temp_dir)
> +
> + args.config = temp_dir + "/xorg.conf"
> + cleanup_files.append(args.config)
> + cf = open(args.config, "w+")
> +
> + logfile = temp_dir + "/xorg.log"
> + cleanup_files.append(logfile)
> +
> + xorg_args = [ '-logfile', logfile ] + xorg_args
> if args.audio_fifo_dir:
> options = 'Option "SpicePlaybackFIFODir" "%s"' % args.audio_fifo_dir
> else:
> --
> 2.1.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151116/fcd59dc8/attachment.sig>
More information about the Spice-devel
mailing list