Skip to content

Commit

Permalink
Extend stream limit to 8MB (#39)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ssbarnea committed Jun 5, 2021
1 parent fd09897 commit daffcbb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/subprocess_tee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
from subprocess import list2cmdline as join # pylint: disable=ungrouped-imports


STREAM_LIMIT = 2 ** 23 # 8MB instead of default 64kb, override it if you need


async def _read_stream(stream: StreamReader, callback: Callable[..., Any]) -> None:
while True:
line = await stream.readline()
Expand Down Expand Up @@ -57,7 +60,7 @@ async def _stream_subprocess(args: str, **kwargs: Any) -> CompletedProcess:
# low
process = await asyncio.create_subprocess_shell(
args,
limit=1024 * 512,
limit=STREAM_LIMIT,
stdin=kwargs.get("stdin", False),
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
Expand Down

0 comments on commit daffcbb

Please sign in to comment.