qa: Consume stdin on Windows platforms

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."
This commit is contained in:
Alex Pyrgiotis 2024-02-15 12:19:16 +02:00
parent 04508d9694
commit fd241e5964
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -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")