From b1baa2b8e1d087c8ef1b271ed5554d37aec17165 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sun, 3 Mar 2019 17:32:28 +0100 Subject: [PATCH] Revert the args file threshold on non-win32 systems from #2214 --- waflib/Task.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/waflib/Task.py b/waflib/Task.py index 776786ae..cb49a739 100644 --- a/waflib/Task.py +++ b/waflib/Task.py @@ -306,14 +306,16 @@ class Task(evil): if hasattr(self, 'stderr'): kw['stderr'] = self.stderr - # workaround for command line length limit: - # http://support.microsoft.com/kb/830473 if not isinstance(cmd, str): - # Calculate commandline length: - cmd_bytes = sum([len(arg) for arg in cmd]) + len(cmd) -1 - # Shunt arguments to a temporary file if the command is - # going to be too long. - if (cmd_bytes >= 8192 if Utils.is_win32 else cmd_bytes > 200000) and getattr(self, 'allow_argsfile', True): + if Utils.is_win32: + # win32 compares the resulting length http://support.microsoft.com/kb/830473 + too_long = sum([len(arg) for arg in cmd]) + len(cmd) > 8192 + else: + # non-win32 counts the amount of arguments (200k) + too_long = len(cmd) > 200000 + + if too_long and getattr(self, 'allow_argsfile', True): + # Shunt arguments to a temporary file if the command is too long. cmd, args = self.split_argfile(cmd) try: (fd, tmp) = tempfile.mkstemp() @@ -328,8 +330,6 @@ class Task(evil): except OSError: # anti-virus and indexers can keep files open -_- pass - # If this line is hit then the command can be passed down stream - # directly. return self.generator.bld.exec_command(cmd, **kw) def process(self):