From: Andrea Righi Date: Mon, 5 Dec 2022 15:07:38 +0000 (+0100) Subject: annotations: prevent python broken pipe errors X-Git-Tag: v0.1~48 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=a7e3a2dea35e912a9b3cae771c4ca2e9bcb81ab8;p=annotations.git annotations: prevent python broken pipe errors Prevent broken pipe errors when showing output in pipe to other tools (less for example). Signed-off-by: Andrea Righi --- diff --git a/annotations b/annotations index 7138e49..a61dd3e 100755 --- a/annotations +++ b/annotations @@ -8,6 +8,7 @@ sys.dont_write_bytecode = True import argparse import json from kconfig.annotations import Annotation, KConfig +from signal import signal, SIGPIPE, SIG_DFL VERSION = '0.1' @@ -206,6 +207,11 @@ def autodetect_annotations(args): arg_fail('error: could not determine DEBDIR, try using: --file/-f') def main(): + # Prevent broken pipe errors when showing output in pipe to other tools + # (less for example) + signal(SIGPIPE, SIG_DFL) + + # Main annotations program args = _ARGPARSER.parse_args() autodetect_annotations(args) if args.value: