[sf-lug] Fwd: stderr and stdout, merged in a single file, in different colors

Asheesh Laroia asheesh at asheesh.org
Sun Sep 28 00:42:15 PDT 2008

On Sat, 27 Sep 2008, Kristian Erik Hermansen wrote:

> This one is a weird question.  I wonder if anyone here has the answer 
> :-)  Regards...

[snipped question about merging stderr and stdout,
with each one in different color]


I wrote an LD_PRELOAD wrapper - stderred.tar.gz, attached - that Just 
Works to solve this problem without the overhead or incorrectness (through 
race conditions) of the Perl solution, which I believe apply to all 
named-pipe implementations.  It has its own problems, but a Java 
programmer will never see them because all Java programs run through the 
Java VM (as further detailed in the READ MORE page).  Crucially it will 
always give you stderr and stdout in the right order, which the Perl and 
zsh solutions I've seen so far can *not* guarantee.  It contains a README 
to explain how to use it and a sample Java program.


It seems kind of silly my full write-up into email, but I do hope everyone 
reads it.  It's at http://www.asheesh.org/note/software/stderred.html .

(Should I have?  Feel free to tell me yes, and then I will next time.)


that I spent far too much of "today" (Saturday) on this.

I'm done with all this for now; I have a working, raceless solution. (-:

I'm CC:ing my friends Venkatesh and Eric who helped me think through this 
and my teacher Peter Froehlich, whose UNIX programming class I never took. 
I may have BCC:d a few other friends who have nothing at all to do with 
this madness.

-- Asheesh.

You are fighting for survival in your own sweet and gentle way.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stderred-1.2.tar.gz
Type: application/octet-stream
Size: 2240 bytes
URL: <http://linuxmafia.com/pipermail/sf-lug/attachments/20080928/8d3de699/attachment.obj>

More information about the sf-lug mailing list