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

Re: Plumbing



> 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
> .

Ah, the infamous multipipe primitives.

> 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.

(Er, ugh.)  If I were to do such a thing, I'd probably change the pipe
primitive to take a list of output-on-left/input-on-right fd pairs,
either counted or explicitly delimited, something like

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

turning into

  %pipe {make universe} 1 0 2 3 . {process_output} 1 0 . {grep errors}

But if we did this, then people would start to want things like circular
pipes, just for the sake of completeness, and the notations get really
absurd.

> Does this make sense, or is the whole idea crazy?

Not crazy.  It's just that the number of times it actually would be used
is probably pretty rare.

> If it makes sense, is there any chance of its seeing the light of day
> in a future "es" release?

Is there any chance of a future release of es seeing the light of day?
I keep saying I'll do it, but I haven't yet, and my attention has
wandered quite far from es.

> Is there more chance if I implement it?

If you implement it, release it as a patch and see if other es users
find it useful.

(And don't bother trying hacks with FIFOs.  They always bite back.)

Paul