Switch RootHelperProcess from select.poll to select.select

The new eventlet 0.20.x that the gate was recently bumped to [1] removed
select.poll [2]. Instead, we should use select.select that is both
supported by eventlet as well as available on all platforms.

[1] I534b8d7d6c2fa00c1fa7d84b3438e6e2b2fcad9e
[2] http://eventlet.net/doc/changelog.html#id2

Change-Id: Ie649abf495e00e7e05de47520ed89bbcd28360db
Closes-Bug: #1674557
This commit is contained in:
Ihar Hrachyshka 2017-03-21 05:23:53 +00:00
parent 0cb8fd6374
commit f48dbeda5c

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):