Bug 1369523 - Avoid reading output file in get_output_from_command when it is not needed. r=aki
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Sat, 03 Jun 2017 17:19:09 +0100
changeset 410506 2a45f5c74d5a525eef9ebd8a57dc519ec857dcdd
parent 410505 978581ff6bf41d89d911efab7c2a6798c4eae7b8
child 410507 32bf1cf6c7a8e96c662c5fac490212071fdef6e6
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1369523
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369523 - Avoid reading output file in get_output_from_command when it is not needed. r=aki
testing/mozharness/mozharness/base/script.py
--- a/testing/mozharness/mozharness/base/script.py
+++ b/testing/mozharness/mozharness/base/script.py
@@ -1565,28 +1565,29 @@ class ScriptMixin(PlatformMixin):
         # XXX: changed from self.debug to self.log due to this error:
         #      TypeError: debug() takes exactly 1 argument (2 given)
         self.log("Temporary files: %s and %s" % (tmp_stdout_filename, tmp_stderr_filename), level=DEBUG)
         p.wait()
         tmp_stdout.close()
         tmp_stderr.close()
         return_level = DEBUG
         output = None
-        if os.path.exists(tmp_stdout_filename) and os.path.getsize(tmp_stdout_filename):
-            output = self.read_from_file(tmp_stdout_filename,
-                                         verbose=False)
-            if not silent:
-                self.log("Output received:", level=log_level)
-                output_lines = output.rstrip().splitlines()
-                for line in output_lines:
-                    if not line or line.isspace():
-                        continue
-                    line = line.decode("utf-8")
-                    self.log(' %s' % line, level=log_level)
-                output = '\n'.join(output_lines)
+        if return_type == 'output' or not silent:
+            if os.path.exists(tmp_stdout_filename) and os.path.getsize(tmp_stdout_filename):
+                output = self.read_from_file(tmp_stdout_filename,
+                                             verbose=False)
+                if not silent:
+                    self.log("Output received:", level=log_level)
+                    output_lines = output.rstrip().splitlines()
+                    for line in output_lines:
+                        if not line or line.isspace():
+                            continue
+                        line = line.decode("utf-8")
+                        self.log(' %s' % line, level=log_level)
+                    output = '\n'.join(output_lines)
         if os.path.exists(tmp_stderr_filename) and os.path.getsize(tmp_stderr_filename):
             if not ignore_errors:
                 return_level = ERROR
             self.log("Errors received:", level=return_level)
             errors = self.read_from_file(tmp_stderr_filename,
                                          verbose=False)
             for line in errors.rstrip().splitlines():
                 if not line or line.isspace():