[gnome-settings-daemon/benzea/ci-fixes: 3/7] tests: Use poll rather than select




commit 802a9d1f3655d931f0432648533d8f6716aaddda
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Jul 19 16:56:58 2021 +0200

    tests: Use poll rather than select
    
    Just because poll is the more modern API.

 tests/output_checker.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/tests/output_checker.py b/tests/output_checker.py
index 7cb1060a..765da9ce 100644
--- a/tests/output_checker.py
+++ b/tests/output_checker.py
@@ -47,12 +47,14 @@ class OutputChecker(object):
         self._thread.start()
 
     def _copy(self):
+        p = select.poll()
+        p.register(self._pipe_fd_r)
         while True:
             try:
                 # Be lazy and wake up occasionally in case _pipe_fd_r became invalid
                 # The reason to do this is because os.read() will *not* return if the
                 # FD is forcefully closed.
-                select.select([self._pipe_fd_r], [], [], 0.1)
+                p.poll(0.1)
 
                 r = os.read(self._pipe_fd_r, 1024)
                 if not r:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]