[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coprocess suggestions
From: |
Chet Ramey |
Subject: |
Re: coprocess suggestions |
Date: |
Wed, 14 Jan 2009 09:33:52 -0500 |
User-agent: |
Thunderbird 2.0.0.19 (Macintosh/20081209) |
Pierre Gaston wrote:
> I have a couple of suggestions about coprocesses.
> If I understood correctly how coproc works, I think that
> instead of :
> coproc [NAME] command [redirections]
>
> the documentation would be a little clearer with something like:
>
> coproc simple-command [redirections]
> coproc NAME compound-command [redirections]
I agree. I will make it clearer that NAME cannot be used if the
coproc command is a simple command, to avoid confusion with the
first word of the command.
> The other suggestions is to change the index of the descriptor array,
> I find much more natural to think about NAME[0] as the descriptor
> number connected to the standard input (0) of the coproc NAME and NAME[1]
> as the fd number connceted to the standard output (1) of the coproc NAME
> rather than the opposite.
> (Maybe you have another point of view on this)
It's a shell-centric implementation. You read from the first descriptor
and write to the second, just like a pipe, so the shell reads from NAME[0]
and writes to NAME[1] to communicate with the coprocess. The coproc
doesn't have access to NAME at all.
> Also coproc is not documented via help.
Good catch, thanks.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/