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

Unified Diff: presubmit_canned_checks.py

Issue 10654002: Pass arguments to pylint child process via a pipe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Addressed nit. Created 8 years, 6 months 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 | pylint » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_canned_checks.py
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index 1558ac3222804570198ab6dcdd1fd1662f5fe63f..6b9383e913c760f4eb5b298ecc22b3e299d27a3d 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -653,11 +653,24 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None,
def run_lint(files):
# We can't import pylint directly due to licensing issues, so we run
# it in another process. Windows needs help running python files so we
- # explicitly specify the interpreter to use.
+ # explicitly specify the interpreter to use. It also has limitations on
+ # the size of the command-line, so we pass arguments via a pipe.
command = [input_api.python_executable,
- input_api.os_path.join(_HERE, 'third_party', 'pylint.py')]
+ input_api.os_path.join(_HERE, 'third_party', 'pylint.py'),
+ '--args-on-stdin']
try:
- return input_api.subprocess.call(command + files + extra_args, env=env)
+ child = input_api.subprocess.Popen(command, env=env,
+ stdin=input_api.subprocess.PIPE)
+
+ # Dump the arguments to the child process via a pipe.
+ for filename in files:
+ child.stdin.write(filename + '\n')
+ for arg in extra_args:
+ child.stdin.write(arg + '\n')
+ child.stdin.close()
+
+ child.communicate()
+ return child.returncode
except OSError:
return 'Pylint failed!'
« no previous file with comments | « no previous file | pylint » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698