Effect's Stdio; the constructor is Stdio.make (terminal
checks default to False).
Attributes#
| Attribute | Type | Description |
|---|---|---|
args | Effect[tuple[str, ...]] | The program's command-line arguments, without the program name. Never fails. |
stdin | Stream[bytes, PlatformError] | Standard input as a stream of byte chunks, ending at end of
input; fails with a |
stdin_is_terminal | Effect[bool] | Whether standard input is attached to a terminal. Never fails. |
stdout_is_terminal | Effect[bool] | Whether standard output is attached to a terminal. Never fails. |
stderr_is_terminal | Effect[bool] | Whether standard error is attached to a terminal. Never fails. |
Functions#
__init__#
__init__(*, args, stdout, stderr, stdin, stdin_is_terminal=_NOT_A_TERMINAL, stdout_is_terminal=_NOT_A_TERMINAL, stderr_is_terminal=_NOT_A_TERMINAL) -> None| Parameter | Type | Description |
|---|---|---|
args | Effect[tuple[str, ...]] | |
stdout | OutputSink | |
stderr | OutputSink | |
stdin | Stream[bytes, PlatformError] | |
stdin_is_terminal | Effect[bool] = _NOT_A_TERMINAL | |
stdout_is_terminal | Effect[bool] = _NOT_A_TERMINAL | |
stderr_is_terminal | Effect[bool] = _NOT_A_TERMINAL |
def __init__(
self,
*,
args: Effect[tuple[str, ...]],
stdout: OutputSink,
stderr: OutputSink,
stdin: Stream[bytes, PlatformError],
stdin_is_terminal: Effect[bool] = _NOT_A_TERMINAL,
stdout_is_terminal: Effect[bool] = _NOT_A_TERMINAL,
stderr_is_terminal: Effect[bool] = _NOT_A_TERMINAL,
) -> None:
for name, value in (
("args", args),
("stdin_is_terminal", stdin_is_terminal),
("stdout_is_terminal", stdout_is_terminal),
("stderr_is_terminal", stderr_is_terminal),
):
require_effect(value, name)
require_stream(stdin, "stdin")
self._args = args
self._stdout = stdout
self._stderr = stderr
self._stdin = stdin
self._stdin_is_terminal = stdin_is_terminal
self._stdout_is_terminal = stdout_is_terminal
self._stderr_is_terminal = stderr_is_terminalstdout#
stdout(*, end_on_done=False) -> OutputA sink writing text and bytes to standard output; with
end_on_done, standard output is closed once the sink's input
ends. The sink fails with a PlatformError when a write does.
| Parameter | Type | Description |
|---|---|---|
end_on_done | bool = False |
Returns Output
def stdout(self, *, end_on_done: bool = False) -> Output:
"""A sink writing text and bytes to standard output; with
``end_on_done``, standard output is closed once the sink's input
ends. The sink fails with a ``PlatformError`` when a write does."""
return self._stdout(end_on_done=end_on_done)stderr#
stderr(*, end_on_done=False) -> OutputA sink writing text and bytes to standard error; with
end_on_done, standard error is closed once the sink's input
ends. The sink fails with a PlatformError when a write does.
| Parameter | Type | Description |
|---|---|---|
end_on_done | bool = False |
Returns Output
def stderr(self, *, end_on_done: bool = False) -> Output:
"""A sink writing text and bytes to standard error; with
``end_on_done``, standard error is closed once the sink's input
ends. The sink fails with a ``PlatformError`` when a write does."""
return self._stderr(end_on_done=end_on_done)