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 @staticmethod
def _read_stream(stream, timeout): def _read_stream(stream, timeout):
if timeout: if timeout:
poller = select.poll() poll_predicate = functools.partial(
poller.register(stream.fileno()) select.select, [stream], [], [], 1)
poll_predicate = functools.partial(poller.poll, 1) common_utils.wait_until_true(
common_utils.wait_until_true(poll_predicate, timeout, 0.1, lambda: poll_predicate()[0], timeout, 0.1,
RuntimeError( RuntimeError('No output in %.2f seconds' % timeout))
'No output in %.2f seconds' % timeout))
return stream.readline() return stream.readline()
def writeline(self, data): def writeline(self, data):