Daemonize follow-up fixes (#81584)

* Ensure binary data transmission in daemonize

* Add changelog fragment
pull/81763/head
Val 1 year ago committed by GitHub
parent 3794612832
commit 91f94fb59d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "``ansible.module_utils.service`` - ensure binary data transmission in ``daemonize()``"

@ -215,9 +215,10 @@ def daemonize(module, cmd):
for out in list(fds):
if out in rfd:
data = os.read(out.fileno(), chunk)
if not data:
if data:
output[out] += to_bytes(data, errors=errors)
else:
fds.remove(out)
output[out] += data
else:
break
@ -248,7 +249,7 @@ def daemonize(module, cmd):
data = os.read(pipe[0], chunk)
if not data:
break
return_data += data
return_data += to_bytes(data, errors=errors)
# Note: no need to specify encoding on py3 as this module sends the
# pickle to itself (thus same python interpreter so we aren't mixing

Loading…
Cancel
Save