Skip to content

Commit

Permalink
Add note about attempting to redirect to buffered I/O targets
Browse files Browse the repository at this point in the history
  • Loading branch information
ronf committed Mar 29, 2024
1 parent 23b3bbf commit 227c566
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions asyncssh/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,14 @@ async def redirect(self, stdin: Optional[ProcessSource] = None,
The default value of `None` means to not change redirection
for that stream.
.. note:: While it is legal to use buffered I/O streams such
as sys.stdin, sys.stdout, and sys.stderr as redirect
targets, you must make sure buffers are flushed
before redirection begins and that these streams
are put back into blocking mode before attempting
to go back using buffered I/O again. Also, no buffered
I/O should be performed while redirection is active.
.. note:: When passing in asyncio streams, it is the responsibility
of the caller to close the associated transport when it
is no longer needed.
Expand Down

0 comments on commit 227c566

Please sign in to comment.