also does anyone have a preferred solution to how sometimes when you pipe / redirect output, it gets buffered? https://blog.plover.com/Unix/stdio-buffering-2.html describes some potential options (like `stdbuf`), but I'm curious about what people actually reach for in practice
I always just end up suffering through it (“I guess I'll get the output if I wait long enough…”)
More about disabling standard I/O buffering
From the highly eclectic blog of Mark DominusThe Universe of Disco : More about disabling standard I/O buffering
Michael Richardson
in reply to Julia Evans • • •Julia Evans
in reply to Michael Richardson • • •@mcr314 not sure what you mean by "doing it wrong", an example is that if I run this Python program as `python3 blah.py | grep .` it won't print out anything for a very long time
(obviously you can address it in this case by adding a flush in the python program, but it's not always possible to modify the program with that behaviour)
```
import time
import datetime
while True:
print(datetime.datetime.now())
time.sleep(1)
```
ttyS1
in reply to Julia Evans • • •In other cases `stdbuf` could help and yes, this can be a pain at times.
For #Perl scripts `$|++` or `$|=1` is a shorthand to turn off buffering on STDOUT.
Dunno for python.
olivia 🏳️⚧️
in reply to Julia Evans • • •cibyr
in reply to Julia Evans • • •