From 9da305e1859bbac632f9a3276d11dba2aaf5faa7 Mon Sep 17 00:00:00 2001 From: Alex Marvin Date: Wed, 7 Feb 2024 21:17:07 -0600 Subject: [PATCH] Fixes xargs partition length on Windows for EXE hooks --- pre_commit/xargs.py | 2 +- tests/xargs_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pre_commit/xargs.py b/pre_commit/xargs.py index 22580f59..3bea9858 100644 --- a/pre_commit/xargs.py +++ b/pre_commit/xargs.py @@ -155,7 +155,7 @@ def xargs( # on windows, batch files have a separate length limit than windows itself if ( sys.platform == 'win32' and - cmd[0].lower().endswith(('.bat', '.cmd')) + cmd[0].lower().endswith(('.bat', '.cmd', '.exe')) ): # pragma: win32 cover # this is implementation details but the command gets translated into # full/path/to/cmd.exe /c *cmd diff --git a/tests/xargs_test.py b/tests/xargs_test.py index e8000b25..c76153c1 100644 --- a/tests/xargs_test.py +++ b/tests/xargs_test.py @@ -243,7 +243,7 @@ def test_xargs_color_true_makes_tty(): @pytest.mark.xfail(os.name == 'posix', reason='nt only') -@pytest.mark.parametrize('filename', ('t.bat', 't.cmd', 'T.CMD')) +@pytest.mark.parametrize('filename', ('t.bat', 't.cmd', 'T.CMD', 't.exe')) def test_xargs_with_batch_files(tmpdir, filename): f = tmpdir.join(filename) f.write('echo it works\n')