Merge pull request #1848 from Akasurde/i1753

Check availability of poll method before using
This commit is contained in:
Kubernetes Prow Robot 2022-07-03 18:03:22 -07:00 committed by GitHub
commit 2677e9c810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,7 +179,7 @@ class WSClient:
# efficient as epoll. Will work for fd numbers above 1024.
# select.epoll() - newest and most efficient way of polling.
# However, only works on linux.
if sys.platform.startswith('linux') or sys.platform in ['darwin']:
if hasattr(select, "poll"):
poll = select.poll()
poll.register(self.sock.sock, select.POLLIN)
r = poll.poll(timeout)