summaryrefslogtreecommitdiffstats
path: root/pre_commit/xargs.py
diff options
context:
space:
mode:
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(