Closed msabramo closed 9 years ago
Not totally fixed ?
$ honcho start
13:49:59 system | web.1 started (pid=21538)
^C13:51:53 system | SIGINT received
13:51:53 system | sending SIGTERM to web.1 (pid 21538)
13:51:53 system | web.1 stopped (rc=-15)
With PYTHONUNBUFFERED, there is one more line :
$ PYTHONUNBUFFERED=1 honcho start
13:52:19 system | web.1 started (pid=21552)
13:52:19 web.1 | serving on http://0.0.0.0:8080
^C13:52:34 system | SIGINT received
13:52:34 system | sending SIGTERM to web.1 (pid 21552)
13:52:34 system | web.1 stopped (rc=-15)
Hmm that could be because of honcho or it could be because of whatever process you're running. What does your Procfile
look like?
I wonder what happens if you add PYTHONUNBUFFERED=1
to .env
or Procfile
?
I don't think this is the right fix. It looks like to me like the buffering is caused by the io.StreamWriter
we're instantiating here, which is intended to ensure that sys.stdout
is set to encode output as UTF-8.
We should be able to remove those lines without ill effect except that this will result in more people complaining about crashes when Honcho tries to emit unicode to terminals that don't have appropriate LANG
settings. (e.g. #51)
At the moment Honcho is being a bit of a bad command-line citizen by actively ignoring the terminal encoding and just spitting out UTF-8. Perhaps the best solution would be to remove the lines which are causing this buffering and emit a warning (perhaps even a fatal error?) if sys.stdout.encoding != 'UTF-8'
...
Agreed. See https://github.com/nickstenning/honcho/pull/139 as a replacement for this PR.
For some reason, output is getting buffered on Python 3.
Fixes GH-136
Cc: @jlirochon