Cannot tail -f | jq
ptbrowne opened this issue · comments
Patrick Browne commented
When I do
logs: tail -f logs
everything is OK, but when I do
logs: tail -f logs | jq '.'
I have no output :/ Same if I do
logs: bash -c "tail -f logs | jq '.'"
I tried to do launch honcho with `env PYTHONUNBUFFERED=1 honcho start' but to no avail.
Is there any solution ?
Nick Stenning commented
Yup, there's a solution!
First of all, you should be able to verify that this isn't a honcho issue by running
tail -f logs | jq '.' | less
You'll see the same problem -- no output.
But you can override the buffering mode of STDOUT for jq using stdbuf(1)
:
tail -f logs | stdbuf -oL jq '.' | less
Or, for honcho:
logs: tail -f logs | stdbuf -oL jq '.'
Patrick Browne commented
Thanks !