Files
AareCommon/src/aarecommon/config/util.py
T
perl_d ba2bc15e13
CI / lint (push) Successful in 21s
CI / test (3.11) (push) Successful in 28s
CI / test (3.13) (push) Successful in 24s
CI / test (3.12) (push) Successful in 25s
feat: add context manager to suppress print from e.g. macros
2026-07-13 12:44:55 +02:00

11 lines
320 B
Python

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:
with redirect_stdout(fnull), redirect_stderr(fnull):
yield