Merge "Switch RootHelperProcess from select.poll to select.select"

This commit is contained in:
Jenkins 2017-03-21 08:13:32 +00:00 committed by Gerrit Code Review
commit 3b119c6471
1 changed files with 5 additions and 6 deletions

View File

@ -289,12 +289,11 @@ class RootHelperProcess(subprocess.Popen):
@staticmethod
def _read_stream(stream, timeout):
if timeout:
poller = select.poll()
poller.register(stream.fileno())
poll_predicate = functools.partial(poller.poll, 1)
common_utils.wait_until_true(poll_predicate, timeout, 0.1,
RuntimeError(
'No output in %.2f seconds' % timeout))
poll_predicate = functools.partial(
select.select, [stream], [], [], 1)
common_utils.wait_until_true(
lambda: poll_predicate()[0], timeout, 0.1,
RuntimeError('No output in %.2f seconds' % timeout))
return stream.readline()
def writeline(self, data):