Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2461)

Unified Diff: remoting/tools/me2me_virtual_host.py

Issue 11715003: Improve xsession execution (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d13b98fa407e6a591d29428699d93e23396ca392 100755
--- a/remoting/tools/me2me_virtual_host.py
+++ b/remoting/tools/me2me_virtual_host.py
@@ -349,17 +349,24 @@ class Desktop:
devnull.close()
def _launch_x_session(self):
- # Start desktop session
+ # Start desktop session.
# The /dev/null input redirection is necessary to prevent the X session
# reading from stdin. If this code runs as a shell background job in a
# terminal, any reading from stdin causes the job to be suspended.
# Daemonization would solve this problem by separating the process from the
# controlling terminal.
+ # If XSESSION_COMMAND is a single item, running with shell=True will
+ # run the file with "/bin/sh -c" which is intelligent about how to execute
+ # the file: It will try to exec() it directly and if that fails, it will
+ # parse any she-bang line and use that, otherwise it will run the file's
+ # contents as a shell-script.
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)
+ env=self.child_env,
+ shell=isinstance(
Sergey Ulanov 2013/01/02 18:42:42 It looks wrong to use shell=True in some cases, bu
Wez 2013/01/02 19:46:20 Two reasons for preferring "shell=False": 1. Redu
Sergey Ulanov 2013/01/02 22:56:54 Not sure how this makes any difference. The comman
+ XSESSION_COMMAND, str))
if not self.session_proc.pid:
raise Exception("Could not start X session")
@@ -494,14 +501,7 @@ def choose_x_session():
for startup_file in XSESSION_FILES:
startup_file = os.path.expanduser(startup_file)
if os.path.exists(startup_file):
- # Use the same logic that a Debian system typically uses with ~/.xsession
- # (see /etc/X11/Xsession.d/50x11-common_determine-startup), to determine
- # exactly how to run this file.
- if os.access(startup_file, os.X_OK):
- return startup_file
Sergey Ulanov 2013/01/02 22:56:54 An alternative fix is to change this line to retur
Lambros 2013/01/03 01:50:26 Done.
- else:
- shell = os.environ.get("SHELL", "sh")
- return [shell, startup_file]
+ return startup_file
Sergey Ulanov 2013/01/02 22:56:54 Does this still work correctly when .xsession or .
# Choose a session wrapper script to run the session. On some systems,
# /etc/X11/Xsession fails to load the user's .profile, so look for an
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698