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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273140802 -3600
# Node ID 460d156da874f4c0e763681e02e9b980426a1e22
# Parent  558ded57c950473fdb2899f31ce568a57df1f52f
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>
---
 tools/python/xen/xm/console.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -r 558ded57c950 -r 460d156da874 tools/python/xen/xm/console.py
--- a/tools/python/xen/xm/console.py    Thu May 06 11:12:11 2010 +0100
+++ b/tools/python/xen/xm/console.py    Thu May 06 11:13:22 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®.