Streaming
provide.foundation.process.sync.streaming
¶
TODO: Add module docstring.
Classes¶
Functions¶
stream
¶
stream(
cmd: list[str],
cwd: str | Path | None = None,
env: Mapping[str, str] | None = None,
timeout: float | None = None,
stream_stderr: bool = False,
**kwargs: Any
) -> Iterator[str]
Stream command output line by line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd
|
list[str]
|
Command and arguments as a list |
required |
cwd
|
str | Path | None
|
Working directory for the command |
None
|
env
|
Mapping[str, str] | None
|
Environment variables |
None
|
timeout
|
float | None
|
Command timeout in seconds |
None
|
stream_stderr
|
bool
|
Whether to stream stderr (merged with stdout) |
False
|
**kwargs
|
Any
|
Additional arguments passed to subprocess.Popen |
{}
|
Yields:
| Type | Description |
|---|---|
str
|
Lines of output from the command |
Raises:
| Type | Description |
|---|---|
ProcessError
|
If command fails |
ProcessTimeoutError
|
If timeout is exceeded |