On Saturday, 19 September 2020 at 14:08:39 UTC, Adam D. Ruppe
wrote:
On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse
wrote:
Is there a way to detect programmatically if I'm in an
environment where I need to manually set line buffering?
Part of the problem is the IDE console and cygwin too I believe
both *look* like a pipe to the program instead of like an
interactive terminal, thus why it gets block instead of line
buffered.
Someone once told me of a trick to detect cygwin specifically
but I can't access it right now and I'm not sure it would work
reliably anyway....
Just yeah set your expectations low because if it was easy to
tell programmatically the libc would already do it right.
Also makes sense, thanks. I already expose the option to force
flushing with a --flush command-line argument, so I guess I'll
keep that around (but use setvbuf when the TERM/uname thing
detects a whitelisted environment).