OutputBroadcaster
🛈 DocStrings¶
Reads a process' output once and distributes it to subscribers.
Source code in src/exxec/output_broadcast.py
__init__
¶
__init__(handle: ProcessHandle, *, backlog_limit: int = DEFAULT_BACKLOG_LIMIT) -> None
Start reading the handle's output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handle
|
ProcessHandle
|
Process whose output to distribute (claims its output stream) |
required |
backlog_limit
|
int
|
Maximum bytes of recent output retained for replay |
DEFAULT_BACKLOG_LIMIT
|
Source code in src/exxec/output_broadcast.py
aclose
async
¶
subscribe
async
¶
Iterate over output chunks until EOF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
replay
|
bool
|
First yield the retained backlog (output produced before subscribing, up to the backlog limit) |
True
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[bytes]
|
Output chunks |
Source code in src/exxec/output_broadcast.py
wait_finished
async
¶
Wait until the output stream reached EOF.
Raises:
| Type | Description |
|---|---|
BaseException
|
The error that terminated the output stream, if any |