Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/prompt_toolkit/patch_stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@contextmanager
def patch_stdout(raw: bool = False) -> Generator[None, None, None]:
"""
Replace `sys.stdout` by an :class:`_StdoutProxy` instance.
Replace `sys.stdout` and `sys.stderr` by an :class:`_StdoutProxy` instance.

Writing to this proxy will make sure that the text appears above the
prompt, and that it doesn't destroy the output from the renderer. If no
Expand All @@ -52,6 +52,9 @@ def patch_stdout(raw: bool = False) -> Generator[None, None, None]:
is changed. Printing to stdout will be scheduled in the event loop
that's active when the context manager is created.

Warning: In order for all text to appear above the prompt `stderr` will also
be redirected to the stdout proxy.

:param raw: (`bool`) When True, vt100 terminal escape sequences are not
removed/escaped.
"""
Expand Down