Re: Output of run script not getting flushed

Daryl Tester <[email protected]> Fri, 22 Mar 2019 22:39:04 +1030
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
On 22/3/19 9:13 pm, Andreas Sommer wrote:

> These are the things I tried:
> - `python -u` (unbuffered) resolves the issue but feels
> like a hack, since usually output should be line-buffered,
> right?

I run a few Python programs under daemontools (and other
service managers) - this is standard behaviour.  As you
noted, you can use "-u" or set the environment variable
PYTHONUNBUFFERED=1.

I believe it's standard C library behaviour - if output
is to a non-tty device (e.g. file or pipe) then stdout/
stderr is switched to block buffered mode instead of
line buffered (e.g. setvbuf(3), stdbuf(1) etc.).


-- 
Regards,
  Daryl Tester
  Handcrafted Computers Pty. Ltd.