From 7ad3acc8faa151e307c82b659f884205ef47012b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 27 Jan 2021 17:04:13 +0100 Subject: Merging upstream version 2.9.3. Signed-off-by: Daniel Baumann --- pre_commit/xargs.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pre_commit/xargs.py') diff --git a/pre_commit/xargs.py b/pre_commit/xargs.py index 7538b54..60a057c 100644 --- a/pre_commit/xargs.py +++ b/pre_commit/xargs.py @@ -137,6 +137,16 @@ def xargs( except parse_shebang.ExecutableNotFoundError as e: return e.to_output()[:2] + # on windows, batch files have a separate length limit than windows itself + if ( + sys.platform == 'win32' and + cmd[0].lower().endswith(('.bat', '.cmd')) + ): # pragma: win32 cover + # this is implementation details but the command gets translated into + # full/path/to/cmd.exe /c *cmd + cmd_exe = parse_shebang.find_executable('cmd.exe') + _max_length = 8192 - len(cmd_exe) - len(' /c ') + partitions = partition(cmd, varargs, target_concurrency, _max_length) def run_cmd_partition( -- cgit v1.2.3