Index: remoting/tools/me2me_virtual_host.py |
diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py |
index eda56485241f35cd9d8ddc310a0f40da2423b34e..47c1e311d56c4d9305695d7bd6e8484423b95318 100755 |
--- a/remoting/tools/me2me_virtual_host.py |
+++ b/remoting/tools/me2me_virtual_host.py |
@@ -25,14 +25,6 @@ import tempfile |
import time |
import uuid |
-# By default this script will try to determine the most appropriate X session |
-# command for the system. To use a specific session instead, set this variable |
-# to the executable filename, or a list containing the executable and any |
-# arguments, for example: |
-# XSESSION_COMMAND = "/usr/bin/gnome-session-fallback" |
-# XSESSION_COMMAND = ["/usr/bin/gnome-session", "--session=ubuntu-2d"] |
-XSESSION_COMMAND = None |
- |
LOG_FILE_ENV_VAR = "CHROME_REMOTE_DESKTOP_LOG_FILE" |
# This script has a sensible default for the initial and maximum desktop size, |
@@ -355,8 +347,12 @@ class Desktop: |
# terminal, any reading from stdin causes the job to be suspended. |
# Daemonization would solve this problem by separating the process from the |
# controlling terminal. |
- logging.info("Launching X session: %s" % XSESSION_COMMAND) |
- self.session_proc = subprocess.Popen(XSESSION_COMMAND, |
+ xsession_command = choose_x_session() |
+ if xsession_command is None: |
+ raise Exception("Unable to choose suitable X session command.") |
+ |
+ logging.info("Launching X session: %s" % xsession_command) |
+ self.session_proc = subprocess.Popen(xsession_command, |
stdin=open(os.devnull, "r"), |
cwd=HOME_DIR, |
env=self.child_env) |
@@ -471,18 +467,12 @@ class PidFile: |
def choose_x_session(): |
"""Chooses the most appropriate X session command for this system. |
- If XSESSION_COMMAND is already set, its value is returned directly. |
- Otherwise, a session is chosen for this system. |
- |
Returns: |
A string containing the command to run, or a list of strings containing |
the executable program and its arguments, which is suitable for passing as |
the first parameter of subprocess.Popen(). If a suitable session cannot |
be found, returns None. |
""" |
- if XSESSION_COMMAND is not None: |
- return XSESSION_COMMAND |
- |
# If the session wrapper script (see below) is given a specific session as an |
# argument (such as ubuntu-2d on Ubuntu 12.04), the wrapper will run that |
# session instead of looking for custom .xsession files in the home directory. |
@@ -867,19 +857,6 @@ Web Store: https://chrome.google.com/remotedesktop""" |
sizes.append((width, height)) |
- # Determine the command-line to run the user's preferred X environment. |
- global XSESSION_COMMAND |
- XSESSION_COMMAND = choose_x_session() |
- if XSESSION_COMMAND is None: |
- print >> sys.stderr, "Unable to choose suitable X session command." |
- return 1 |
- |
- if "--session=ubuntu-2d" in XSESSION_COMMAND: |
- print >> sys.stderr, ( |
- "The Unity 2D desktop session will be used.\n" |
- "If you encounter problems with this choice of desktop, please install\n" |
- "the gnome-session-fallback package, and restart this script.\n") |
- |
# Register an exit handler to clean up session process and the PID file. |
atexit.register(cleanup) |