Bug 1287234 - Do not merge stdout and stderr in get_output. r?gps draft
authorMike Hommey <mh@glandium.org>
Sat, 16 Jul 2016 09:46:40 +0900
changeset 8913 e8fc8b042a265d01e9d5a3731df3931e10c9e473
parent 8870 12c7707aa8fe510842a2cb8ad27b80af483cb62b
child 8914 8e693f0ba1f7efeca7f3334bcde735f62cb10795
push id1025
push userbmo:mh+mozilla@glandium.org
push dateSat, 16 Jul 2016 01:01:51 +0000
reviewersgps
bugs1287234
Bug 1287234 - Do not merge stdout and stderr in get_output. r?gps The commands get_output is run for may emit messages on stderr that are only noise for the git mozreview script, altering the expected output. With current git cinnabar tip of the release branch, a warning may be emitted when running `git cinnabar hg2git`, which prevents `git mozreview configure` from finding the right repository because the output contains more than the expected sha1s. MozReview-Commit-ID: 5HUvprewVP1
git/commands/git-mozreview
--- a/git/commands/git-mozreview
+++ b/git/commands/git-mozreview
@@ -166,18 +166,19 @@ def sendauthenticatedhttprequest(git_con
 
     req = requests.Request(url=url, auth=BugzillaAPIKeyAuth(git_config),
                            **kwargs)
     return session.send(req.prepare())
 
 
 def get_output(args, cwd=None):
     try:
-        output = subprocess.check_output(args, stderr=subprocess.STDOUT,
-                                         cwd=cwd)
+        with open(os.devnull, 'w') as stderr:
+            output = subprocess.check_output(args, stderr=stderr,
+                                             cwd=cwd)
         return 0, output
     except subprocess.CalledProcessError as e:
         return e.returncode, e.output
 
 
 def get_git_config():
     res, output = get_output(['git', 'config', '--list', '-z'])
     if res: