Closed MeabhG closed 4 years ago
This has been a constant bugbear of mine. Python's default behaviour is to buffer writes to STDOUT when STDOUT is not a TTY.
I've changed Honcho's behaviour in d12e85f to always line-buffer output.
Thanks @nickstenning When do you think you'll be releasing a version that includes this change?
When Honcho receives output from the processes it starts it buffers it before flushing to file. Adding
self.output.flush()
here (could be controlled by a config variable) would allow it to be line buffered. But there might be a better solution.How to reproduce:
printing.py
run.sh
Procfile
Python no buffering
docker run -d --rm --name honcho -v $(pwd)/printing.py:/printing.py --entrypoint /usr/local/bin/python docker-hub.ihs.demonware.net/python:3.7.5-stretch /printing.py
anddocker logs -f honcho
in a second terminal to show line buffered logshoncho buffering
docker run -d --rm --name honcho -v $(pwd)/printing.py:/printing.py -v $(pwd)/run.sh:/run.sh -v $(pwd)/Procfile:/etc/honcho/Procfile --entrypoint bash docker-hub.ihs.demonware.net/python:3.7.5-stretch /run.sh
anddocker logs -f honcho
in a second terminal to showhoncho
buffered logs (wait a few minutes for log dump)Same behaviour with
docker-hub.ihs.demonware.net/python:2.7.16-stretch