Skip to main content

subprocess.run 的异步克隆

项目描述

见主函数的文档:

async def run(
    args: Sequence[StrBytes],
    cwd: Optional[Path] = None,
    env: Optional[Union[Mapping[StrBytes, StrBytes]]] = None,
    env_override: Optional[Mapping[StrBytes, StrBytes]] = None,
    capture_output: bool = False,
    check: bool = False,
    text: Optional[bool] = None,
) -> subprocess.CompletedProcess:
    """An async clone of `subprocess.run`.

    Suppose you have Python script that orchestrates shell commands,
    but it's too slow, and you've identified commands which can run in
    parallel. You could use `threading`, but that has GIL problems, or
    `multiprocess`, which has a high startup-cost per worker. You are
    already spinning off subprocesses, which the OS will run
    concurrently, so why not use async/await programming to express
    concurrency in a single thread?

    Note this function does not permit you to communicate
    asynchronously, just to run commands asynchronously.

    This function supports a subset of the signature of
    `subprocess.run`, that I will expand based on need. If you need
    some functionality, submit an issue or PR.

    """

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

charmonium.async_subprocess-0.1.7.ta​​r.gz (3.2 kB 查看哈希)

已上传 source

内置分布

charmonium.async_subprocess-0.1.7-py3-none-any.whl (3.7 kB 查看哈希

已上传 py3