Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stdin ssh flush #366

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change Log
============

2.12.1
+++++++

Fixes
------

* Calling ``HostOutput.stdin.flush`` with a ``pssh.clients.ssh`` client would raise exception - #.

2.12.0
+++++++

Expand Down
2 changes: 2 additions & 0 deletions pssh/clients/base/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def write(self, data):

def flush(self):
"""Flush pending data written to stdin."""
if not hasattr(self._channel, "flush"):
return
return self._client._eagain(self._channel.flush)


Expand Down
8 changes: 8 additions & 0 deletions tests/ssh/test_single_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,11 @@ def _disc():
client._disconnect_eagain = _disc
client._connect_init_session_retry(0)
client.disconnect()

def test_stdin(self):
host_out = self.client.run_command('read line; echo $line')
host_out.stdin.write('a line\n')
host_out.stdin.flush()
self.client.wait_finished(host_out)
stdout = list(host_out.stdout)
self.assertListEqual(stdout, ['a line'])