Add osx specific limit for command-line length

Limit on OSX is 262144
This commit is contained in:
Andrew S. Brown 2019-02-06 11:58:03 -08:00
parent 6bc7b91dd1
commit 7f9b29dfd4
2 changed files with 16 additions and 0 deletions

View file

@ -36,6 +36,13 @@ def linux_mock():
yield
@pytest.fixture
def osx_mock():
with mock.patch.object(sys, 'getfilesystemencoding', return_value='utf-8'):
with mock.patch.object(sys, 'platform', 'darwin'):
yield
def test_partition_trivial():
assert xargs.partition(('cmd',), (), 1) == (('cmd',),)
@ -88,6 +95,13 @@ def test_partition_limit_linux(linux_mock):
assert ret == (cmd + varargs,)
def test_partition_limit_osx(osx_mock):
cmd = ('ninechars',)
varargs = (('x' * 9,) * 26214)
ret = xargs.partition(cmd, varargs, 1)
assert ret == (cmd + varargs[0:26213], (cmd + varargs[26213:]))
def test_argument_too_long_with_large_unicode(linux_mock):
cmd = ('ninechars',)
varargs = ('😑' * 10,) # 4 bytes * 10