On Thu, 2011-04-14 at 12:24 -0700, Howard Chu wrote: > > However, you could do both with some heuristics. Hm. Maybe not. I was > > going to say you could merge them if stdout and stderr were going to the > > same tty or file, but I don't think there's any good way in UNIX to know > > whether two file descriptors are pointing at the same file/device. Hrm. > > In Linux you can find out via /proc but that's a pretty special case. > > > You wouldn't just use fstat() and compare dev and ino numbers?
Hm, I wasn't sure that would work with everything, such as pipes, but it does seem to have "correct enough" behavior in some quick tests I did (Linux only though). Cool! So, the heuristic would be: * If stdout and stderr go to the same place (dev/ino are equal), use a merged output method * If stdout and stderr go to different places (dev/ino are not equal), use individual outputs (the method the current patch uses). Not sure if/how this will work for Windows and the other ports, but we can fall back to the merged method if not supported. On the other hand heuristics are annoying if they tend to get things wrong. I think this is pretty solid, myself, but please pipe up if you see issues with it. -- ------------------------------------------------------------------------------- Paul D. Smith <psm...@gnu.org> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make