mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 20:40:08 -06:00
Bound maxsize by 4096 when SC_ARG_MAX is not present
This commit is contained in:
@@ -25,7 +25,7 @@ def _environ_size(_env=None):
|
||||
def _get_platform_max_length(): # pragma: no cover (platform specific)
|
||||
if os.name == 'posix':
|
||||
maximum = os.sysconf(str('SC_ARG_MAX')) - 2048 - _environ_size()
|
||||
maximum = min(maximum, 2 ** 17)
|
||||
maximum = max(min(maximum, 2 ** 17), 2 ** 12)
|
||||
return maximum
|
||||
elif os.name == 'nt':
|
||||
return 2 ** 15 - 2048 # UNICODE_STRING max - headroom
|
||||
|
||||
Reference in New Issue
Block a user