tests: Unicode/bytes fixes for integration/connection/exec_command.yml

issue510
David Wilson 6 years ago
parent 4d443e654b
commit 35092c5d35

@ -914,9 +914,9 @@ class Connection(ansible.plugins.connection.ConnectionBase):
emulate_tty=emulate_tty,
)
stderr += 'Shared connection to %s closed.%s' % (
self._play_context.remote_addr,
('\r\n' if emulate_tty else '\n'),
stderr += b'Shared connection to %s closed.%s' % (
self._play_context.remote_addr.encode(),
(b'\r\n' if emulate_tty else b'\n'),
)
return rc, stdout, stderr

@ -541,7 +541,7 @@ def exec_args(args, in_data='', chdir=None, shell=None, emulate_tty=False):
if emulate_tty:
stdout = stdout.replace(b'\n', b'\r\n')
return proc.returncode, stdout, stderr or ''
return proc.returncode, stdout, stderr or b''
def exec_command(cmd, in_data='', chdir=None, shell=None, emulate_tty=False):

@ -15,5 +15,5 @@
- assert:
that:
- out.result[0] == 0
- out.result[1] == "hello, world\r\n"
- out.result[2].startswith("Shared connection to ")
- out.result[1].decode() == "hello, world\r\n"
- out.result[2].decode().startswith("Shared connection to ")

Loading…
Cancel
Save