Commit c53b8cbf authored by bratell@opera.com's avatar bratell@opera.com

Remove unused print_output argument from upload.py

R=dpranke@chromium.org,tandrii@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1545913002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298097 0039d316-1c4b-4281-b951-d872f2087c98
parent 3a1707d7
...@@ -842,15 +842,12 @@ def GetContentType(filename): ...@@ -842,15 +842,12 @@ def GetContentType(filename):
# Use a shell for subcommands on Windows to get a PATH search. # Use a shell for subcommands on Windows to get a PATH search.
use_shell = sys.platform.startswith("win") use_shell = sys.platform.startswith("win")
def RunShellWithReturnCodeAndStderr(command, print_output=False, def RunShellWithReturnCodeAndStderr(command, universal_newlines=True,
universal_newlines=True, env=os.environ):
env=os.environ):
"""Run a command and return output from stdout, stderr and the return code. """Run a command and return output from stdout, stderr and the return code.
Args: Args:
command: Command to execute. command: Command to execute.
print_output: If True, the output is printed to stdout.
If False, both stdout and stderr are ignored.
universal_newlines: Use universal_newlines flag (default: True). universal_newlines: Use universal_newlines flag (default: True).
Returns: Returns:
...@@ -862,40 +859,20 @@ def RunShellWithReturnCodeAndStderr(command, print_output=False, ...@@ -862,40 +859,20 @@ def RunShellWithReturnCodeAndStderr(command, print_output=False,
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=use_shell, universal_newlines=universal_newlines, shell=use_shell, universal_newlines=universal_newlines,
env=env) env=env)
if print_output: output, errout = p.communicate()
# 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
# since this code path is rarely used.
output_array = []
while True:
line = p.stdout.readline()
if not line:
break
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, errout = p.communicate()
p.stdout.close() p.stdout.close()
p.stderr.close() p.stderr.close()
return output, errout, p.returncode return output, errout, p.returncode
def RunShellWithReturnCode(command, print_output=False, def RunShellWithReturnCode(command, universal_newlines=True, env=os.environ):
universal_newlines=True,
env=os.environ):
"""Run a command and return output from stdout and the return code.""" """Run a command and return output from stdout and the return code."""
out, err, retcode = RunShellWithReturnCodeAndStderr(command, print_output, out, err, retcode = RunShellWithReturnCodeAndStderr(command,
universal_newlines, env) universal_newlines, env)
return out, retcode return out, retcode
def RunShell(command, silent_ok=False, universal_newlines=True, def RunShell(command, silent_ok=False, universal_newlines=True,
print_output=False, env=os.environ): env=os.environ):
data, retcode = RunShellWithReturnCode(command, print_output, data, retcode = RunShellWithReturnCode(command, universal_newlines, env)
universal_newlines, env)
if retcode: if retcode:
ErrorExit("Got error status from %s:\n%s" % (command, data)) ErrorExit("Got error status from %s:\n%s" % (command, data))
if not silent_ok and not data: if not silent_ok and not data:
...@@ -1768,7 +1745,7 @@ class PerforceVCS(VersionControlSystem): ...@@ -1768,7 +1745,7 @@ class PerforceVCS(VersionControlSystem):
args.extend(extra_args) args.extend(extra_args)
data, retcode = RunShellWithReturnCode( data, retcode = RunShellWithReturnCode(
args, print_output=False, universal_newlines=universal_newlines) args, universal_newlines=universal_newlines)
if marshal_output and data: if marshal_output and data:
data = marshal.loads(data) data = marshal.loads(data)
return data, retcode return data, retcode
......
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