From 05faadf64391a90ced437b05e30b1196f98db3bf Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Wed, 12 Apr 2017 17:32:28 -0700 Subject: [PATCH] [buck] fix argument list too long issue Reviewed By: jvillard Differential Revision: D4878637 fbshipit-source-id: 7568a5b --- infer/lib/python/inferlib/bucklib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/infer/lib/python/inferlib/bucklib.py b/infer/lib/python/inferlib/bucklib.py index 5c9b6e8fc..705eec8ec 100644 --- a/infer/lib/python/inferlib/bucklib.py +++ b/infer/lib/python/inferlib/bucklib.py @@ -230,7 +230,11 @@ class Wrapper: self.buck_args = buck_args self.normalized_targets = get_normalized_targets( buck_args.targets) - self.buck_cmd = base_cmd + self.normalized_targets + # 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.timer.stop('%d targets computed', len(self.normalized_targets)) def _collect_results(self, start_time):