Re:How to write to stderr so people will like you
by jrockway on Friday April 16, 2010 @01:39PM
(#1271276)
If the process you're piping to never reads stdin and your process writes to stdout with a blocking write, you will eventually be blocked. But just use an event loop for stdout, and all will be well. (That way your program is in control of its own buffering and blocking. select is probably good enough in this case.)
Anyway, if you want to see freakin' echo block because of this, try:
$ mkfifo foo
$ echo "OH HAI" > foo
<blocks>
In another xterm: $ cat foo
<echo unblocks and exits>.
Re:How to write to stderr so people will like you
by btilly on Friday April 16, 2010 @01:40PM
(#1271284)
The potential problem comes when stdout and stderr are going to different places. For instance stdout is going to the next stage in a pipeline while stderr is going to the console. Then the error message winds up waiting for the buffering program.
I believe pipes are block-buffered and basically look just like redirecting to a file.