diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-09-10 18:06:00 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-09-10 18:06:00 +0100 |
commit | 17bcd2bcdb8de4818b361582ac4d833ff324f4ff (patch) | |
tree | 6e8cff6017b168a5c0229f99bd8784c39acb70cb | |
parent | 4440c9094d853a452cbff6f9801fc7d47352e9b4 (diff) | |
download | sos-17bcd2bcdb8de4818b361582ac4d833ff324f4ff.tar.gz |
[utilities] wait until AsyncReader p.poll() returns None
On some systems the pipe used by the AsyncReader() class and the
sos_get_command_output() function may still be open at the time
the p.poll() call returns. At this time the command exit status
is undefined, leading to errors and collection failures for code
that tests the command's exit code.
Wait explicitly until poll() returns None to avoid this.
Resolves: #1417
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/utilities.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sos/utilities.py b/sos/utilities.py index d112e15a..25e10429 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -155,7 +155,8 @@ def sos_get_command_output(command, timeout=300, stderr=False, reader = AsyncReader(p.stdout, sizelimit, binary) stdout = reader.get_contents() - p.poll() + while p.poll() == None: + pass except OSError as e: if e.errno == errno.ENOENT: |