Changed select timeout value to 1 second in _wait_for_commands so processes
that exit without producing output don't block until the overall timeout
value.
Signed-off-by: Bryce Boe <bboe@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2091 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index 2001a4d..8cb7b5e 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -324,6 +324,10 @@
def _wait_for_commands(bg_jobs, start_time, timeout):
# This returns True if it must return due to a timeout, otherwise False.
+ # To check for processes which terminate without producing any output
+ # a 1 second timeout is used in select.
+ SELECT_TIMEOUT = 1
+
select_list = []
reverse_dict = {}
for bg_job in bg_jobs:
@@ -340,7 +344,7 @@
while not timeout or time_left > 0:
# select will return when stdout is ready (including when it is
# EOF, that is the process has terminated).
- ready, _, _ = select.select(select_list, [], [], time_left)
+ ready, _, _ = select.select(select_list, [], [], SELECT_TIMEOUT)
# os.read() has to be used instead of
# subproc.stdout.read() which will otherwise block