Goncalo Gomes
2010-May-05 10:47 UTC
[Xen-devel] [PATCH] Add exception handling when launching vncviewer
The attached patch: 1. Replaces the call to ''puts'' with ''print'' as the former is undefined in python 2. Adds exception handling when attempting to execute a missing vncviewer and prints convenient information. Cheers, -Goncalo. Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.Citrix.COM> diff -r efa1b905d893 tools/python/xen/xm/console.py --- a/tools/python/xen/xm/console.py Tue May 04 13:59:55 2010 +0100 +++ b/tools/python/xen/xm/console.py Wed May 05 04:39:18 2010 +0100 @@ -74,10 +74,15 @@ if do_daemonize: pid = utils.daemonize(''vncviewer'', cmdl, vnc_password_tmpfile) if pid == 0: - puts >>sys.stderr, ''failed to invoke vncviewer'' + print >>sys.stderr, ''failed to invoke vncviewer'' os._exit(-1) else: print ''invoking '', '' ''.join(cmdl) if vnc_password_tmpfile is not None: os.dup2(vnc_password_tmpfile.fileno(), 0) - os.execvp(''vncviewer'', cmdl) + try: + os.execvp(''vncviewer'', cmdl) + except OSError: + print >>sys.stderr, ''Error: external vncviewer missing or not \ +in the path\nExiting'' + os._exit(-1) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel