mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Bound maxsize by 4096 when SC_ARG_MAX is not present
This commit is contained in:
parent
5169f455c9
commit
681d78b6cf
1 changed files with 1 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ def _environ_size(_env=None):
|
||||||
def _get_platform_max_length(): # pragma: no cover (platform specific)
|
def _get_platform_max_length(): # pragma: no cover (platform specific)
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
maximum = os.sysconf(str('SC_ARG_MAX')) - 2048 - _environ_size()
|
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
|
return maximum
|
||||||
elif os.name == 'nt':
|
elif os.name == 'nt':
|
||||||
return 2 ** 15 - 2048 # UNICODE_STRING max - headroom
|
return 2 ** 15 - 2048 # UNICODE_STRING max - headroom
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue