mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
log-search: Prevent BrokenPipeError exceptions when run with head
.
See https://docs.python.org/3/library/signal.html#note-on-sigpipe
This commit is contained in:
committed by
Tim Abbott
parent
be960f4142
commit
3bf83e8830
@@ -226,6 +226,12 @@ def main() -> None:
|
||||
filter_types=filter_types,
|
||||
use_color=use_color,
|
||||
)
|
||||
except BrokenPipeError:
|
||||
# Python flushes standard streams on exit; redirect remaining output
|
||||
# to devnull to avoid another BrokenPipeError at shutdown
|
||||
devnull = os.open(os.devnull, os.O_WRONLY)
|
||||
os.dup2(devnull, sys.stdout.fileno())
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(signal.SIGINT + 128)
|
||||
|
||||
|
Reference in New Issue
Block a user