From 1fbc4a1b2261ce266e2600b5f68fa8435af91b9e Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Tue, 16 May 2017 15:11:08 -0700 Subject: [PATCH] [infer][java] remove the temporary file created to store the list of Buck targets Reviewed By: sblackshear Differential Revision: D5056897 fbshipit-source-id: 1d0a233 --- infer/lib/python/inferlib/bucklib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/infer/lib/python/inferlib/bucklib.py b/infer/lib/python/inferlib/bucklib.py index 705eec8ec..dcb62eadf 100644 --- a/infer/lib/python/inferlib/bucklib.py +++ b/infer/lib/python/inferlib/bucklib.py @@ -230,11 +230,13 @@ class Wrapper: self.buck_args = buck_args self.normalized_targets = get_normalized_targets( buck_args.targets) + self.temp_files = [] # write targets to file to avoid passing too many command line args with tempfile.NamedTemporaryFile(delete=False, prefix='targets_') as targets_file: targets_file.write('\n'.join(self.normalized_targets)) self.buck_cmd = base_cmd + ['@%s' % targets_file.name] + self.temp_files.append(targets_file.name) self.timer.stop('%d targets computed', len(self.normalized_targets)) def _collect_results(self, start_time): @@ -243,7 +245,6 @@ class Wrapper: self.timer.stop('Done') def run(self): - temp_files = [] start_time = time.time() try: logging.info('Starting the analysis') @@ -253,7 +254,7 @@ class Wrapper: self.timer.start('Preparing build ...') temp_files2, infer_script = prepare_build(self.infer_args) - temp_files += temp_files2 + self.temp_files += temp_files2 self.timer.stop('Build prepared') if len(self.normalized_targets) == 0: @@ -280,4 +281,4 @@ class Wrapper: return os.EX_OK raise e finally: - cleanup(temp_files) + cleanup(self.temp_files)