Blame SOURCES/sos-bz1623070-pipe-returncode.patch
|
|
b72d26 |
From 17bcd2bcdb8de4818b361582ac4d833ff324f4ff Mon Sep 17 00:00:00 2001
|
|
|
b72d26 |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
b72d26 |
Date: Mon, 10 Sep 2018 18:06:00 +0100
|
|
|
b72d26 |
Subject: [PATCH] [utilities] wait until AsyncReader p.poll() returns None
|
|
|
b72d26 |
|
|
|
b72d26 |
On some systems the pipe used by the AsyncReader() class and the
|
|
|
b72d26 |
sos_get_command_output() function may still be open at the time
|
|
|
b72d26 |
the p.poll() call returns. At this time the command exit status
|
|
|
b72d26 |
is undefined, leading to errors and collection failures for code
|
|
|
b72d26 |
that tests the command's exit code.
|
|
|
b72d26 |
|
|
|
b72d26 |
Wait explicitly until poll() returns None to avoid this.
|
|
|
b72d26 |
|
|
|
b72d26 |
Resolves: #1417
|
|
|
b72d26 |
|
|
|
b72d26 |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
b72d26 |
---
|
|
|
b72d26 |
sos/utilities.py | 3 ++-
|
|
|
b72d26 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
b72d26 |
|
|
|
b72d26 |
diff --git a/sos/utilities.py b/sos/utilities.py
|
|
|
b72d26 |
index d112e15a..25e10429 100644
|
|
|
b72d26 |
--- a/sos/utilities.py
|
|
|
b72d26 |
+++ b/sos/utilities.py
|
|
|
b72d26 |
@@ -155,7 +155,8 @@ def sos_get_command_output(command, timeout=300, stderr=False,
|
|
|
b72d26 |
|
|
|
b72d26 |
reader = AsyncReader(p.stdout, sizelimit, binary)
|
|
|
b72d26 |
stdout = reader.get_contents()
|
|
|
b72d26 |
- p.poll()
|
|
|
b72d26 |
+ while p.poll() is None:
|
|
|
b72d26 |
+ pass
|
|
|
b72d26 |
|
|
|
b72d26 |
except OSError as e:
|
|
|
b72d26 |
if e.errno == errno.ENOENT:
|
|
|
b72d26 |
--
|
|
|
b72d26 |
2.17.1
|
|
|
b72d26 |
|