News for hackers. Stuff that matters.
Re:Make your STDERR red by vilhelm_s on Tuesday December 13, 2011 @11:33PM (#3350611)
Here is an example illustrating what I mean:

    #include <stdio.h>
    int main() {
       while (1) {
           fprintf(stdout, "Hi.\n");
           fprintf(stderr, "Hello.\n");
       }
       return 0;
    }
If you run this program directly from the shell, every odd line says Hi and every even line says Hello. But if you run it through sexec (on a Linux machine at least), you get a large block of lines saying Hi, followed by a large block saying Hello, etc. Whether this is a problem or not of course depends on the use case. But to avoid it you need something more sophisticated than just pipes, e.g. the LD_PRELOAD hack in the original post.
Re:Make your STDERR red by colmmacc on Tuesday December 13, 2011 @11:44PM (#3350639)
Now I get you. I'm tempted to write a small pty allocator which does enough to allow isatty() return true.
Re:Make your STDERR red by catwell on Wednesday December 14, 2011 @07:35AM (#3351573)
Or you could just disable buffering, for instance with the unbuffer tool that comes with Expect:

    ./mytest | tee out.txt # blocks of Hello. and Hi.
    unbuffer ./mytest | tee out.txt # expected result
Re:Make your STDERR red by burgerbrain on Wednesday December 14, 2011 @12:33PM (#3352703)
Without looking at it's source, what 'unbuffer' does is likely allocate a PTY for the things under it. That's how the rest of Expect works after all ;)