From 7c1a01b186ad8048e54e29be57e7b7973fde24d8 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Thu, 18 May 2017 09:15:16 -0700 Subject: [PATCH] [clang] Make keep going work with the infer-capture-all integration Reviewed By: mbouaziz Differential Revision: D5086779 fbshipit-source-id: f3c4670 --- infer/lib/python/inferlib/capture/buck.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/infer/lib/python/inferlib/capture/buck.py b/infer/lib/python/inferlib/capture/buck.py index b550066dd..612927e9f 100644 --- a/infer/lib/python/inferlib/capture/buck.py +++ b/infer/lib/python/inferlib/capture/buck.py @@ -27,6 +27,8 @@ Analysis examples: infer -- buck build HelloWorld''' LANG = ['clang', 'java'] +KEEP_GOING_OPTION = "--keep-going" + def gen_instance(*args): return BuckAnalyzer(*args) @@ -132,6 +134,8 @@ class BuckAnalyzer: 'targets', '--show-output' ] + self.cmd[2:] + self.create_cxx_buck_configuration_args() + buck_results_cmd = \ + [x for x in buck_results_cmd if x != KEEP_GOING_OPTION] proc = subprocess.Popen(buck_results_cmd, stdout=subprocess.PIPE) (buck_output, _) = proc.communicate() # remove target name prefixes from each line and split them into a list @@ -173,8 +177,16 @@ class BuckAnalyzer: if self.args.load_average is not None: command += ['-L', str(self.args.load_average)] command += self.create_cxx_buck_configuration_args() - subprocess.check_call(command, env=env) - return os.EX_OK + try: + subprocess.check_call(command, env=env) + return os.EX_OK + except subprocess.CalledProcessError as e: + if KEEP_GOING_OPTION in self.args.Xbuck: + print('Buck failed, but continuing the analysis ' + 'because --keep-going was passed') + return os.EX_OK + else: + raise e def capture_with_flavors(self): ret = self._run_buck_with_flavors()