zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Andrew Main <zefram@tao.co.uk>
Cc: zsh-workers@math.gatech.edu
Subject: Re: Speaking of "coproc" ...
Date: Tue, 5 May 1998 03:43:07 -0700	[thread overview]
Message-ID: <980505034307.ZM7951@candle.brasslantern.com> (raw)
In-Reply-To: <199805050902.KAA04301@taos.demon.co.uk>

On May 5, 10:02am, Andrew Main wrote:
} Subject: Re: Speaking of "coproc" ...
}
} Bart Schaefer wrote:
} >How does one close the input to the coproc, so as to send it an end-of-file?
} >The only thing I've come up with is "coproc exit" which seems rather silly
} >and which closes both the input and the output.
} 
} Coprocesses are a bit of a mess.  I'd like to make it possible to attach
} the coprocess to specified fd numbers, just like file redirections,

That's easily accomplished already, by e.g. 3<&p or 4>&p.  The odd bit is
that when ksh does >&p, it -closes- the "p" descriptor after dup'ing it.
When zsh does >&p, it leaves "p" open, so you can do >&p again to the same
coprocess.  (This is not true of <&p, which makes me think >&p has a bug.)

This has some interesting side effects, one of which is that there's no
way to explicitly close down the coproc input (except to start another).

} so that one could close either pipe with the ">&-" syntax.  This would
} also make it possible to have multiple independent coprocesses.

That's also already possible, as someone on the zsh-users thread pointed
out.

	coproc first-coproc
	exec 3<&p 4>&p
	coproc second-coproc
	exec 5<&p 6>&p
	coproc etcetera

} To do this properly I think we'd need an extended redirection syntax,
} to allow redirecting file descriptors of more than one digit

That's completely orthogonal.

} perhaps we could do something like the rc syntax?

I don't know what that is.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      reply	other threads:[~1998-05-05 10:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-03  9:43 Bart Schaefer
1998-05-05  9:02 ` Andrew Main
1998-05-05 10:43   ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=980505034307.ZM7951@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zefram@tao.co.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).