Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 681d78b

Browse files
committed
Bound maxsize by 4096 when SC_ARG_MAX is not present
1 parent 5169f45 commit 681d78b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pre_commit/xargs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _environ_size(_env=None):
2525
def _get_platform_max_length(): # pragma: no cover (platform specific)
2626
if os.name == 'posix':
2727
maximum = os.sysconf(str('SC_ARG_MAX')) - 2048 - _environ_size()
28-
maximum = min(maximum, 2 ** 17)
28+
maximum = max(min(maximum, 2 ** 17), 2 ** 12)
2929
return maximum
3030
elif os.name == 'nt':
3131
return 2 ** 15 - 2048 # UNICODE_STRING max - headroom

0 commit comments

Comments
 (0)