News for hackers. Stuff that matters.
Re:How to write to stderr so people will like you by Periodic on Friday April 16, 2010 @01:29PM (#1271229)
Won't it just get buffered into the other program's input buffer?

I believe pipes are block-buffered and basically look just like redirecting to a file.

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.
Re:How to write to stderr so people will like you by gte910h on Friday April 16, 2010 @06:31PM (#1272141)
Yes exactly. This is the scenario I'm worried about. It's pretty common actually (think logging, etc)