Skip to content

Commit 9dbffd7

Browse files
authored
Clarify that patch_stdout also redirect stderr (#2029)
1 parent 01fb11f commit 9dbffd7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/prompt_toolkit/patch_stdout.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
@contextmanager
4141
def patch_stdout(raw: bool = False) -> Generator[None, None, None]:
4242
"""
43-
Replace `sys.stdout` by an :class:`_StdoutProxy` instance.
43+
Replace `sys.stdout` and `sys.stderr` by an :class:`_StdoutProxy` instance.
4444
4545
Writing to this proxy will make sure that the text appears above the
4646
prompt, and that it doesn't destroy the output from the renderer. If no
@@ -52,6 +52,9 @@ def patch_stdout(raw: bool = False) -> Generator[None, None, None]:
5252
is changed. Printing to stdout will be scheduled in the event loop
5353
that's active when the context manager is created.
5454
55+
Warning: In order for all text to appear above the prompt `stderr` will also
56+
be redirected to the stdout proxy.
57+
5558
:param raw: (`bool`) When True, vt100 terminal escape sequences are not
5659
removed/escaped.
5760
"""

0 commit comments

Comments
 (0)