Fix _CheckFilePermissions to actually flag presubmit errors
Previously it was misusing subprocess.Popen such that no output
was ever captured from checkperms.py.
Also, changed the check to use input_api.subprocess instead of importing subprocess.
[email protected]
NOTRY=true
Review URL: https://codereview.chromium.org/143013004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247805 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index d19fa7f7..2e6c077 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -10,7 +10,6 @@
import re
-import subprocess
import sys
@@ -526,14 +525,13 @@
input_api.change.RepositoryRoot()]
for f in input_api.AffectedFiles():
args += ['--file', f.LocalPath()]
- errors = []
- (errors, stderrdata) = subprocess.Popen(args).communicate()
-
- results = []
+ checkperms = input_api.subprocess.Popen(args,
+ stdout=input_api.subprocess.PIPE)
+ errors = checkperms.communicate()[0].strip()
if errors:
- results.append(output_api.PresubmitError('checkperms.py failed.',
- errors))
- return results
+ return [output_api.PresubmitError('checkperms.py failed.',
+ errors.splitlines())]
+ return []
def _CheckNoAuraWindowPropertyHInHeaders(input_api, output_api):