[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.0-testing] xm: Add exception handling when launching vncviewer



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273481373 -3600
# Node ID cca6b6c6f8388f5541f9ece1286c7c7d60f6871c
# Parent  90c006910f53ded63126f0d2230c7645a4be76d5
xm: Add exception handling when launching vncviewer

Also replaces the call to 'puts' with 'print' as the former is
undefined in python

Signed-off-by: Goncalo Gomes <Goncalo.Gomes@xxxxxxxxxxxxx>
xen-unstable changeset:   21296:460d156da874
xen-unstable date:        Thu May 06 11:13:22 2010 +0100
---
 tools/python/xen/xm/console.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -r 90c006910f53 -r cca6b6c6f838 tools/python/xen/xm/console.py
--- a/tools/python/xen/xm/console.py    Mon May 10 09:48:55 2010 +0100
+++ b/tools/python/xen/xm/console.py    Mon May 10 09:49:33 2010 +0100
@@ -74,10 +74,15 @@ def runVncViewer(domid, do_autopass, do_
     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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.