diff --git a/Applications/Python/ogs/dev/ogs_log_summary.py b/Applications/Python/ogs/dev/ogs_log_summary.py index 5e6153391e7..3aa4e8c916f 100755 --- a/Applications/Python/ogs/dev/ogs_log_summary.py +++ b/Applications/Python/ogs/dev/ogs_log_summary.py @@ -8,12 +8,9 @@ from collections import defaultdict from decimal import ROUND_DOWN, ROUND_UP, Decimal from pathlib import Path -from signal import SIG_DFL, SIGPIPE, signal import pandas as pd -signal(SIGPIPE, SIG_DFL) - logger = logging.getLogger(__name__) re_prj_file = re.compile("info: Reading project file (.*)[.]$") @@ -324,4 +321,11 @@ def run(log_files_dirs, xml_out_dir, verbose): ch.setFormatter(formatter) logger.addHandler(ch) - run(args.log_files_dirs, snippet_out, args.verbose) + # suppress error message from Python interpreter, e.g., if a command + # pipeline exits early, see + # https://docs.python.org/3/library/signal.html#note-on-sigpipe + try: + run(args.log_files_dirs, snippet_out, args.verbose) + except BrokenPipeError: + devnull = os.open(os.devnull, os.O_WRONLY) + os.dup2(devnull, sys.stdout.fileno())