On Thu, 2011-04-14 at 14:08 -0400, David Boyce wrote: > On Thu, Apr 14, 2011 at 1:29 PM, Paul Smith <psm...@gnu.org> wrote: > > One example: I think saving stdout and stderr to different files and > > then printing them separately is problematic; consider if your recipe > > prints lots of information lines, with errors (to stdout) interspersed. > > If you throw all the errors to the end you lose a lot of context. > > The reason is that the SHELL variable is used not only for recipes but > also for the $(shell) function. Intermingling stdout and stderr in the > result of $(shell) is just disastrously wrong (as I found in the first > iteration of syncsh). I spent some time trying to find a way to > determine, from inside a child shell, whether we were forked by a > recipe or by $(shell) but could find no reliable way. Thus syncsh was > forced to keep them in separate files. Since $(shell) invocations are > not "jobs" according to make's process model there's no need for them > to participate in synchronization at all, so it may be that within > make there's a way to only sync on recipes which in turn would allow > 2>&1.
Your latter statement is absolutely correct: it's wrong for $(shell ...) to synchronize. Shell function output is captured by make, not printed to stdout, so synchronizing it doesn't make much sense. > Of course, either way some context is lost. If you put both into one > temp file you lose track of which was which; if you keep them in > separate files you lose ordering instead. So it becomes a matter of > taste, or perhaps an option though that seems like a bit too much to > me. I agree that adding an option seems like a lot. I think it's more important to maintain ordering of stdout/stderr than it is to allow individual redirection. 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. -- ------------------------------------------------------------------------------- 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