mirror of https://github.com/zulip/zulip.git
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:
parent
be960f4142
commit
3bf83e8830
|
@ -226,6 +226,12 @@ def main() -> None:
|
||||||
filter_types=filter_types,
|
filter_types=filter_types,
|
||||||
use_color=use_color,
|
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:
|
except KeyboardInterrupt:
|
||||||
sys.exit(signal.SIGINT + 128)
|
sys.exit(signal.SIGINT + 128)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue