In case the process has terminated, we
have to make sure to read till EOF, otherwise
we might skip some bytes.
Fixes: https://tracker.ceph.com/issues/44642
Co-authored-by: Tim Serong <tserong@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
message = message_b.decode('utf-8')
if isinstance(message_b, str):
message = message_b
+ if stop and message:
+ # process has terminated, but have more to read still, so not stopping yet
+ # (os.read returns '' when it encounters EOF)
+ stop = False
+ if not message:
+ continue
if fd == process.stdout.fileno():
out += message
message = out_buffer + message