Bug 1325481 - Update clang-format fetch/locate codepath to gracefully fail. r?sylvestre draft
authorBryce Van Dyk <bvandyk@mozilla.com>
Fri, 23 Dec 2016 11:15:00 +1300
changeset 553932 f26a61ec1137803d015db9608583ba2ec5df7ac6
parent 553822 8df9fabf2587b7020889755acb9e75b664fe13cf
child 622240 74a5269fa02ed3af4f0ada4a9fb280787ee034fa
push id51826
push userbvandyk@mozilla.com
push dateFri, 31 Mar 2017 00:32:55 +0000
reviewerssylvestre
bugs1325481
milestone55.0a1
Bug 1325481 - Update clang-format fetch/locate codepath to gracefully fail. r?sylvestre The checking on the return of value of fetch/locate is not working as intended. The code should be early returning, but the return value of fetch/locate is 1 in failure cases, which will not trigger the early return. The return value has been altered to None, which will trigger the early return. MozReview-Commit-ID: FDCW6rbZI6T
tools/mach_commands.py
--- a/tools/mach_commands.py
+++ b/tools/mach_commands.py
@@ -294,17 +294,17 @@ class FormatProvider(MachCommandBase):
         }
 
         target = os.path.join(self._mach_context.state_dir, os.path.basename(root))
 
         if not os.path.exists(target):
             tooltool_url = "https://api.pub.build.mozilla.org/tooltool/sha512/"
             if self.prompt and raw_input("Download clang-format executables from {0} (yN)? ".format(tooltool_url)).lower() != 'y':  # noqa: E501,F821
                 print("Download aborted.")
-                return 1
+                return None
             self.prompt = False
             plat = platform.system()
             if python_script:
                 # We want to download the python script (clang-format-diff)
                 dl = bin_sha["python_script"]
             else:
                 dl = bin_sha[plat]
             u = tooltool_url + dl