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

Unified Diff: third_party/upload.py

Issue 1544813002: Fix git cl upload deadlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Other quotation marks. Created 5 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: third_party/upload.py
diff --git a/third_party/upload.py b/third_party/upload.py
index 002a0d66a7d149e255f26fbeea33d43a78730f7e..def9094e16ba4725e27bce1d750a7c5201815793 100755
--- a/third_party/upload.py
+++ b/third_party/upload.py
@@ -863,6 +863,9 @@ def RunShellWithReturnCodeAndStderr(command, print_output=False,
shell=use_shell, universal_newlines=universal_newlines,
env=env)
if print_output:
+ # It's very hard to stream both stdout and stderr at the same time
+ # without the potential for deadlocks. We will hope for the best
tandrii(chromium) 2015/12/22 14:49:37 indeed, hard. we have a subprocess2 module for thi
+ # since this code path is rarely used.
output_array = []
while True:
line = p.stdout.readline()
@@ -871,12 +874,12 @@ def RunShellWithReturnCodeAndStderr(command, print_output=False,
print line.strip("\n")
output_array.append(line)
output = "".join(output_array)
+ p.wait()
+ errout = p.stderr.read()
+ if errout:
+ print >> sys.stderr, errout
else:
- output = p.stdout.read()
- p.wait()
- errout = p.stderr.read()
- if print_output and errout:
- print >> sys.stderr, errout
+ output, errout = p.communicate()
p.stdout.close()
p.stderr.close()
return output, errout, p.returncode
@@ -1448,6 +1451,9 @@ class GitVCS(VersionControlSystem):
env = os.environ.copy()
if "GIT_EXTERNAL_DIFF" in env:
del env["GIT_EXTERNAL_DIFF"]
+ # 'cat' is a magical git string that disables pagers on all platforms.
+ env["GIT_PAGER"] = "cat"
+
# -M/-C will not print the diff for the deleted file when a file is renamed.
# This is confusing because the original file will not be shown on the
# review when a file is renamed. So, get a diff with ONLY deletes, then
« 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