feat: add context manager to suppress print from e.g. macros #34

Merged
perl_d merged 1 commits from live_260713 into main 2026-09-09 17:07:52 +02:00
+9
View File
@@ -0,0 +1,9 @@
import os
from contextlib import contextmanager, redirect_stderr, redirect_stdout
@contextmanager
def suppress_output():
"""Suppress both stdout and stderr by redirecting them to os.devnull."""
with open(os.devnull, "w") as fnull, redirect_stdout(fnull), redirect_stderr(fnull):
yield