datalad_next.runners

Execution of subprocesses

This module provides all relevant components for subprocess execution.

Low-level tooling

Few process execution/management utilities are provided, for generic command execution, and for execution command in the context of a Git repository.

GitRunner

alias of GitWitlessRunner

Runner

alias of WitlessRunner

iter_subproc(args, *[, input, chunk_size, cwd])

Context manager to communicate with a subprocess using iterables

iter_git_subproc(args, **kwargs)

iter_subproc() wrapper for calling Git commands

Additional information on the design of the subprocess execution tooling is available from https://docs.datalad.org/design/threaded_runner.html

A standard exception type is used to communicate any process termination with a non-zero exit code

CommandError([cmd, msg, code, stdout, ...])

Thrown if a command call fails.

Command output can be processed via "protocol" implementations that are inspired by asyncio.SubprocessProtocol.

KillOutput([done_future, encoding])

WitlessProtocol that swallows stdout/stderr of a subprocess

NoCapture([done_future, encoding])

WitlessProtocol that captures no subprocess output

StdOutCapture([done_future, encoding])

WitlessProtocol that only captures and returns stdout of a subprocess

StdErrCapture([done_future, encoding])

WitlessProtocol that only captures and returns stderr of a subprocess

StdOutErrCapture([done_future, encoding])

WitlessProtocol that captures and returns stdout/stderr of a subprocess