summaryrefslogtreecommitdiffstats
path: root/pre_commit/xargs.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-27 16:04:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-27 16:04:26 +0000
commit7ad3acc8faa151e307c82b659f884205ef47012b (patch)
treeda74df356ea350b3ee9fb0bf71937e0bdb7896a6 /pre_commit/xargs.py
parentReleasing debian version 2.8.2-1. (diff)
downloadpre-commit-7ad3acc8faa151e307c82b659f884205ef47012b.tar.xz
pre-commit-7ad3acc8faa151e307c82b659f884205ef47012b.zip
Merging upstream version 2.9.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/xargs.py')
-rw-r--r--pre_commit/xargs.py10
1 files changed, 10 insertions, 0 deletions
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(