Commit 5cc6c57b authored by dpranke@google.com's avatar dpranke@google.com

Fix output reordering when you get a conflict on an update.

If you're not running gclient sync with --verbose and you get a conflict on
a file, the conflict message prints *before* the message that you're running
update in the appropriate directory. This is happening because we intercept
stdout but not stderr, and the conflict prompt goes to stderr. redirecting
stderr in the popen() to the pipe fixes this.

  R=maruel@chromium.org
  BUG=none
  TEST=none

Review URL: http://codereview.chromium.org/373003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@31276 0039d316-1c4b-4281-b951-d872f2087c98
parent cef0db9d
...@@ -209,7 +209,8 @@ def SubprocessCallAndFilter(command, ...@@ -209,7 +209,8 @@ def SubprocessCallAndFilter(command,
# executable, but shell=True makes subprocess on Linux fail when it's called # executable, but shell=True makes subprocess on Linux fail when it's called
# with a list because it only tries to execute the first item in the list. # with a list because it only tries to execute the first item in the list.
kid = subprocess.Popen(command, bufsize=0, cwd=in_directory, kid = subprocess.Popen(command, bufsize=0, cwd=in_directory,
shell=(sys.platform == 'win32'), stdout=subprocess.PIPE) shell=(sys.platform == 'win32'), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
# Also, we need to forward stdout to prevent weird re-ordering of output. # Also, we need to forward stdout to prevent weird re-ordering of output.
# This has to be done on a per byte basis to make sure it is not buffered: # This has to be done on a per byte basis to make sure it is not buffered:
......
...@@ -1071,7 +1071,8 @@ class SubprocessCallAndFilterTestCase(BaseTestCase): ...@@ -1071,7 +1071,8 @@ class SubprocessCallAndFilterTestCase(BaseTestCase):
gclient.sys.stdout.write(i) gclient.sys.stdout.write(i)
gclient_utils.subprocess.Popen(command, bufsize=0, cwd=in_directory, gclient_utils.subprocess.Popen(command, bufsize=0, cwd=in_directory,
shell=(gclient.sys.platform == 'win32'), shell=(gclient.sys.platform == 'win32'),
stdout=gclient_utils.subprocess.PIPE).AndReturn(kid) stdout=gclient_utils.subprocess.PIPE,
stderr=gclient_utils.subprocess.STDOUT).AndReturn(kid)
self.mox.ReplayAll() self.mox.ReplayAll()
compiled_pattern = re.compile(pattern) compiled_pattern = re.compile(pattern)
line_list = [] line_list = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment