▲ | BoingBoomTschak 10 hours ago | |||||||
Also made a post some time ago about the issue: https://world-playground-deceit.net/blog/2024/09/bourne_shel... About the commands that don't buffer, this is either implementation dependent or even wrong in the case of cat (cf https://pubs.opengroup.org/onlinepubs/9799919799/utilities/c... and `-u`). Massive pain that POSIX never included an official way to manage this. Not mentioned is input buffering, that would gives you this strange result:
The fix is to use `stdbuf -i0 head -1`, in this case. | ||||||||
▲ | jagrsw 8 hours ago | parent [-] | |||||||
I don't believe a process reading from a pipe/socketpair/whatever can enforce such constraints on a writing process (except using heavy hackery like ptrace()). While it might be possible to adjust the pipe buffer size, I'm not aware of any convention requiring standard C I/O to respect this. In any case, stdbuf doesn't seem to help with this:
| ||||||||
|