From fd241e5964423ab00765564c551b0c43a75f7cb1 Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Thu, 15 Feb 2024 12:19:16 +0200 Subject: [PATCH] qa: Consume stdin on Windows platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows platforms, we can't consume the stdin using select(), because it's not available for pipes [1]. We can instead consume it using some native Windows calls. [1]: From https://docs.python.org/3/library/select.html#select.select: "File objects on Windows are not acceptable, but sockets are. On Windows, the underlying select() function is provided by the WinSock library, and does not handle file descriptors that don’t originate from WinSock." --- dev_scripts/qa.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev_scripts/qa.py b/dev_scripts/qa.py index fb19190..cd359c7 100755 --- a/dev_scripts/qa.py +++ b/dev_scripts/qa.py @@ -724,6 +724,13 @@ class QAWindows(QABase): REF_BUILD = Reference("BUILD.md", content=CONTENT_BUILD_WINDOWS) + def _consume_stdin(self): + # NOTE: We can't use select() on Windows. See: + # https://docs.python.org/3/library/select.html#select.select + import msvcrt + while msvcrt.kbhit(): + msvcrt.getch() + @QABase.task("Install and Run Docker Desktop", ref=REF_BUILD) def install_docker(self): logger.info("Checking if Docker Desktop is installed and running")