[gnome-shell] Catch exception raised when Xephyr can't be found



commit 22835b35e7e0685e870bc6d37f26afce2667c90c
Author: Siegfried Gevatter <rainct ubuntu com>
Date:   Mon Apr 6 16:10:03 2009 +0200

    Catch exception raised when Xephyr can't be found
    
    If Xephyr isn't installed currently src/gnome-shell raises
    an exception which isn't at all obvious without looking at
    the source. This commit catches the exception and replaces
    it with a more informative error message.
---
 src/gnome-shell.in |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/gnome-shell.in b/src/gnome-shell.in
index abaec6a..a5dc96d 100755
--- a/src/gnome-shell.in
+++ b/src/gnome-shell.in
@@ -11,6 +11,7 @@ import subprocess
 import sys
 import tempfile
 import time
+import errno
 
 def find_cmd (cmd_list):
     """
@@ -70,10 +71,17 @@ def start_xephyr():
         raise RuntimeError("xauth failed")
 
     # Launch Xephyr
-    xephyr = subprocess.Popen(["Xephyr", display,
-                               "-auth", xauth_file,
-                               "-screen", options.geometry,
-                               "-host-cursor"])
+    try:
+        xephyr = subprocess.Popen(["Xephyr", display,
+                                   "-auth", xauth_file,
+                                   "-screen", options.geometry,
+                                   "-host-cursor"])
+    except OSError, e:
+        if e.errno == errno.ENOENT:
+            print "Could not find Xephyr."
+            sys.exit(1)
+        else:
+            raise
     os.environ['DISPLAY'] = display
     os.environ['XAUTHORITY'] = xauth_file
 



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