[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [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@xxxxxxxxxxxxx> 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) Attachment:
console.diff _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |