Bug 1300779 - [mozlint] Redirect stderr when detecting version control root, r?smacleod
This avoids printing harmless (but confusing) errors to the log. For instance, git users
will see a '.hg not found!' error in the output even though not finding an hg repo is
expected in that case.
MozReview-Commit-ID: DBPOabcV7PA
--- a/python/mozlint/mozlint/vcs.py
+++ b/python/mozlint/mozlint/vcs.py
@@ -18,17 +18,17 @@ class VCSFiles(object):
# First check if we're in an hg repo, if not try git
commands = (
['hg', 'root'],
['git', 'rev-parse', '--show-toplevel'],
)
for cmd in commands:
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = proc.communicate()[0].strip()
if proc.returncode == 0:
self._vcs = cmd[0]
self._root = output
return self._root
@property