mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2025-12-06 07:45:35 +01:00
12 lines
334 B
Python
12 lines
334 B
Python
import asyncio
|
|
from typing import Optional
|
|
|
|
|
|
async def run_cmd(cmd: str) -> tuple[bytes, bytes, Optional[int]]:
|
|
proc = await asyncio.create_subprocess_shell(
|
|
cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
|
)
|
|
|
|
stdout, stderr = await proc.communicate()
|
|
return stdout, stderr, proc.returncode
|