From 5e3289f5bdd2af02423b9975749e53c011b8dcfa Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Wed, 5 Feb 2025 12:57:17 +0100 Subject: [PATCH] fix(macos): suppress IMKClient warning on macos --- bec_widgets/cli/client_utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bec_widgets/cli/client_utils.py b/bec_widgets/cli/client_utils.py index a788c462..020f1751 100644 --- a/bec_widgets/cli/client_utils.py +++ b/bec_widgets/cli/client_utils.py @@ -34,6 +34,17 @@ else: logger = bec_logger.logger +def _filter_output(output: str) -> str: + """ + Filter out the output from the process. + """ + if "IMKClient" in output: + # only relevant on macOS + # see https://discussions.apple.com/thread/255761734?sortBy=rank + return "" + return output + + def _get_output(process, logger) -> None: log_func = {process.stdout: logger.debug, process.stderr: logger.error} stream_buffer = {process.stdout: [], process.stderr: []} @@ -47,6 +58,7 @@ def _get_output(process, logger) -> None: if stream in readylist: buf.append(stream.read(4096)) output, _, remaining = "".join(buf).rpartition("\n") + output = _filter_output(output) if output: log_func[stream](output) buf.clear()