aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-05-10 09:49:33 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-05-10 09:49:33 +0100
commit85bef2cc8dec14b5e89b2e5bbaf31b0cd2281f18 (patch)
tree68f46d9c7c3ae21072d0f45951e9e024f2986978
parentd9c8338f78137a530e677f007fe673c4d98d79c6 (diff)
downloadxen-85bef2cc8dec14b5e89b2e5bbaf31b0cd2281f18.tar.gz
xen-85bef2cc8dec14b5e89b2e5bbaf31b0cd2281f18.tar.bz2
xen-85bef2cc8dec14b5e89b2e5bbaf31b0cd2281f18.zip
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@eu.Citrix.com> xen-unstable changeset: 21296:460d156da874 xen-unstable date: Thu May 06 11:13:22 2010 +0100
-rw-r--r--tools/python/xen/xm/console.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/python/xen/xm/console.py b/tools/python/xen/xm/console.py
index f31d561836..ce86369c63 100644
--- a/tools/python/xen/xm/console.py
+++ b/tools/python/xen/xm/console.py
@@ -74,10 +74,15 @@ def runVncViewer(domid, do_autopass, do_daemonize=False):
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)