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