Add ability to silence aria2c's output

This commit is contained in:
rlaphoenix 2023-02-22 03:06:17 +00:00
parent 0913b0dda6
commit 4406e3bbab
1 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@ async def aria2c(
headers: Optional[dict] = None,
proxy: Optional[str] = None,
byte_range: Optional[str] = None,
silent: bool = False,
*args: str
) -> int:
"""
@ -88,7 +89,9 @@ async def aria2c(
p = await asyncio.create_subprocess_exec(
executable,
*arguments,
stdin=subprocess.PIPE
stdin=subprocess.PIPE,
stderr=[None, subprocess.DEVNULL][silent],
stdout=[None, subprocess.DEVNULL][silent]
)
await p.communicate(uri.encode())