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.
This commit is contained in:
Siegfried Gevatter 2009-04-06 16:10:03 +02:00 committed by Owen W. Taylor
parent 2ea5012535
commit 22835b35e7

View File

@ -11,6 +11,7 @@ import subprocess
import sys import sys
import tempfile import tempfile
import time import time
import errno
def find_cmd (cmd_list): def find_cmd (cmd_list):
""" """
@ -70,10 +71,17 @@ def start_xephyr():
raise RuntimeError("xauth failed") raise RuntimeError("xauth failed")
# Launch Xephyr # Launch Xephyr
xephyr = subprocess.Popen(["Xephyr", display, try:
"-auth", xauth_file, xephyr = subprocess.Popen(["Xephyr", display,
"-screen", options.geometry, "-auth", xauth_file,
"-host-cursor"]) "-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['DISPLAY'] = display
os.environ['XAUTHORITY'] = xauth_file os.environ['XAUTHORITY'] = xauth_file