Merge "Switch RootHelperProcess from select.poll to select.select" into stable/newton

This commit is contained in:
Jenkins 2017-04-13 00:11:34 +00:00 committed by Gerrit Code Review
commit 2ede419c59
1 changed files with 5 additions and 6 deletions

View File

@ -267,12 +267,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):