brotli CLI: how to stop continuous compression and write valid file? #528

Open
opened 2026-01-29 20:45:14 +00:00 by claunia · 0 comments
Owner

Originally created by @derhuerst on GitHub (Dec 3, 2024).

I'm trying to compress a the data from continuous stream of logs for a certain period of time. At some point, I want the brotli CLI to stop compressing and write a clean/valid brotli-compressed file.

bash -c 'while true; do echo "some log line"; sleep 1; done' | brotli >logs.txt.br
# After some time, I send SIGINT via ctrl + c.
# ^C

# Once the `brotli` process has exited, I would expect to be able to read the compressed file. However, this is not possible:
brotli -d foo.txt.br | wc -l
# corrupt input [foo.txt.br]
#        0

This also doesn't work with SIGQUIT, SIGTERM and SIGHUP.

Originally created by @derhuerst on GitHub (Dec 3, 2024). I'm trying to compress a the data from continuous stream of logs for a certain period of time. At some point, I want the `brotli` CLI to stop compressing and write a clean/valid brotli-compressed file. ```shell bash -c 'while true; do echo "some log line"; sleep 1; done' | brotli >logs.txt.br # After some time, I send SIGINT via ctrl + c. # ^C # Once the `brotli` process has exited, I would expect to be able to read the compressed file. However, this is not possible: brotli -d foo.txt.br | wc -l # corrupt input [foo.txt.br] # 0 ``` This also doesn't work with `SIGQUIT`, `SIGTERM` and `SIGHUP`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#528