Skip to content

Commit 3a016cf

Browse files
pkittenisTysher
andauthored
Join encoding (#223)
* Pass through encoding parameter on calling join * Added test for passing encoding parameter to join * Updated changelog Co-authored-by: Tysher <jose.horta@gmail.com>
1 parent f8bc2aa commit 3a016cf

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Fixes
2929
-----
3030

3131
* Removed now unnecessary locking around SSHClient initialisation so it can be parallelised - #219.
32+
* ``ParallelSSHClient.join`` with encoding would not pass on encoding when reading from output buffers - #214.
3233

3334

3435
1.13.0

pssh/clients/base/parallel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def join(self, output, consume_output=False, timeout=None,
257257
if not isinstance(output, list):
258258
raise ValueError("Unexpected output object type")
259259
cmds = [self.pool.spawn(self._join, host_out, timeout=timeout,
260-
consume_output=consume_output)
260+
consume_output=consume_output, encoding=encoding)
261261
for host_i, host_out in enumerate(output)]
262262
# Errors raised by self._join should be propagated.
263263
finished_cmds = joinall(cmds, raise_error=True, timeout=timeout)

tests/native/test_parallel_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,14 @@ def test_ssh_client_utf_encoding(self):
10801080
_stdout = list(output[0].stdout)
10811081
self.assertEqual([_utf16], _stdout)
10821082

1083+
def test_ssh_client_utf_encoding_join(self):
1084+
_utf16 = u'é'.encode('utf-8').decode('utf-16')
1085+
cmd = u"echo 'é'"
1086+
output = self.client.run_command(cmd, encoding='utf-16')
1087+
self.client.join(output, encoding='utf-16')
1088+
stdout = list(output[0].stdout)
1089+
self.assertEqual([_utf16], stdout)
1090+
10831091
def test_pty(self):
10841092
cmd = "echo 'asdf' >&2"
10851093
expected_stderr = ['asdf']

0 commit comments

Comments
 (0)