From 87af46ff8cb62e246ef20a4faa00a4180af58e49 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 2 Dec 2020 10:30:22 +0100 Subject: [PATCH] Silence "Exception ignored when trying to write to the signal wakeup fd" Disable warn_on_full_buffer via set_wakeup_fd. This avoids tons of Exception ignored when trying to write to the signal wakeup fd: BlockingIOError: [Errno 11] Resource temporarily unavailable that are currently issued after running complex builds. Only works since Python 3.7, though, so this remains best-effort. Fortunately, the Debian in our container image is 3.7. Signed-off-by: Jan Kiszka --- kas/libkas.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kas/libkas.py b/kas/libkas.py index 8be0e0f..939589f 100644 --- a/kas/libkas.py +++ b/kas/libkas.py @@ -31,6 +31,7 @@ import tempfile import asyncio import errno import pathlib +import signal from subprocess import Popen, PIPE from .context import get_context @@ -93,6 +94,13 @@ async def run_cmd_async(cmd, cwd, env=None, fail=True, liveupdate=True): logo = LogOutput(liveupdate) + try: + orig_fd = signal.set_wakeup_fd(-1, warn_on_full_buffer=False) + signal.set_wakeup_fd(orig_fd, warn_on_full_buffer=False) + except TypeError: + # Python < 3.7 - we tried our best + pass + try: process = await asyncio.create_subprocess_exec( *cmd,