diff options
-rw-r--r-- | paramiko/channel.py | 12 | ||||
-rw-r--r-- | sites/www/changelog.rst | 6 |
2 files changed, 16 insertions, 2 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py index 9f2d8f01..72f65012 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -1366,6 +1366,12 @@ class ChannelFile(BufferedFile): class ChannelStderrFile(ChannelFile): + """ + A file-like wrapper around `.Channel` stderr. + + See `Channel.makefile_stderr` for details. + """ + def _read(self, size): return self.channel.recv_stderr(size) @@ -1375,6 +1381,12 @@ class ChannelStderrFile(ChannelFile): class ChannelStdinFile(ChannelFile): + """ + A file-like wrapper around `.Channel` stdin. + + See `Channel.makefile_stdin` for details. + """ + def close(self): super(ChannelStdinFile, self).close() self.channel.shutdown_write() diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index abd73b06..8838f5aa 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -6,13 +6,15 @@ Changelog <paramiko.client.SSHClient.exec_command>` previously returned a naive `~paramiko.channel.ChannelFile` object for its ``stdin`` value; such objects don't know to properly shut down the remote end's stdin when they - ``.close()``. This leads to issues when running remote commands that read - from stdin. + ``.close()``. This lead to issues (such as hangs) when running remote + commands that read from stdin. A new subclass, `~paramiko.channel.ChannelStdinFile`, has been created which closes remote stdin when it itself is closed. `~paramiko.client.SSHClient.exec_command` has been updated to use that class for its ``stdin`` return value. + + Thanks to Brandon Rhodes for the report & steps to reproduce. - :release:`2.5.0 <2019-06-09>` - :feature:`1233` (also :issue:`1229`, :issue:`1332`) Add support for encrypt-then-MAC (ETM) schemes (``hmac-sha2-256-etm@openssh.com``, |