Skip to content

Commit daffcbb

Browse files
authored
Extend stream limit to 8MB (#39)
It seems that even 0.5MB was not enough for some Ansible users so we bump the limit to 8MB and allow users to override the value. Fixes: ansible/molecule#3112
1 parent fd09897 commit daffcbb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/subprocess_tee/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
from subprocess import list2cmdline as join # pylint: disable=ungrouped-imports
1919

2020

21+
STREAM_LIMIT = 2 ** 23 # 8MB instead of default 64kb, override it if you need
22+
23+
2124
async def _read_stream(stream: StreamReader, callback: Callable[..., Any]) -> None:
2225
while True:
2326
line = await stream.readline()
@@ -57,7 +60,7 @@ async def _stream_subprocess(args: str, **kwargs: Any) -> CompletedProcess:
5760
# low
5861
process = await asyncio.create_subprocess_shell(
5962
args,
60-
limit=1024 * 512,
63+
limit=STREAM_LIMIT,
6164
stdin=kwargs.get("stdin", False),
6265
stdout=asyncio.subprocess.PIPE,
6366
stderr=asyncio.subprocess.PIPE,

0 commit comments

Comments
 (0)