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!' |