[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plumbing



[I have sent a please-subscribe-me message to es-request,
 but haven't yet had an acknowledgement. I'd therefore
 appreciate being sent copies of any replies to this. -- g]

Suppose you're doing some operation that produces a lot of
output, and possibly some error output too (a big "make",
say). It would be useful to be able to distinguish between
the two kinds of output; but you don't just want to send them
to different places, because you want to keep the two
synchronised.

What would be good would be the ability to connect both fd 1
and fd 2 of one process to two different fd's of another
process: some syntax like

    make universe |[1=0,2=3] process_output

or maybe

    make universe |[1=0][2=3] process_output
.

It's not clear to me what the right way of modifying the pipe
primitive for this would be; probably something like

    %pipe {make universe} '1 2' '0 3' {process_output}

would be best.


Does this make sense, or is the whole idea crazy? If it makes
sense, is there any chance of its seeing the light of day in
a future "es" release? Is there more chance if I implement it?

(It might be possible to get a similar effect by redirecting
stderr of the first process to a fifo file, but I can't get this
to do what I want because it seems that the first process can't
write to the fifo unless the second is actually waiting for
input from it; |select()|ing on it isn't enough. This is a
nuisance.)

-- 
Gareth McCaughan       Dept. of Pure Mathematics & Mathematical Statistics,
gjm11@dpmms.cam.ac.uk  Cambridge University, England.