zsh-workers
 help / color / mirror / code / Atom feed
* coprocess file descriptor p isn't closed after coprocess exits
@ 2009-07-29 19:19 Mikael Magnusson
  2009-07-29 23:46 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2009-07-29 19:19 UTC (permalink / raw)
  To: zsh-workers

The commit message for the read -q fix mentioned read -p, so i did
read -<tab> to see the description and didn't see anything. Turns out
it only completes -p if you have a coproc open since -p reads from the
coprocess. However, after you kill the coprocess it still completes
-p. This made me a bit suspicious and i played around with >&p (which
the completer uses to test if there is a coprocess).
% zsh -f; echo oops: $?
% true >&p
zsh: coprocess: bad file descriptor
% echo >&p
zsh: coprocess: bad file descriptor
% coproc true
[1] 5794
%
[1]  + done       true
% true >&p && echo $?
0
% echo >&p && echo $?
oops: 141

I've tried this on 4.3.5 and fairly recent zsh cvs.
[ doing trap 'echo oops i got a sigpipe' PIPE gives an amusing (and
ctrl-c-able) loop of
  echo: write error: broken pipe
  zsh: write error: broken pipe ]

I couldn't figure out any syntax for closing the p descriptor manually
like you would do with exec 2>&-
p>&- obviously just tries to run the command 'p'.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: coprocess file descriptor p isn't closed after coprocess exits
  2009-07-29 19:19 coprocess file descriptor p isn't closed after coprocess exits Mikael Magnusson
@ 2009-07-29 23:46 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2009-07-29 23:46 UTC (permalink / raw)
  To: Mikael Magnusson, zsh-workers

On Jul 29,  9:19pm, Mikael Magnusson wrote:
} Subject: coprocess file descriptor p isn't closed after coprocess exits

The coprocess descriptor is like any other FIFO; it stays open until
both ends are done with it.  See more explanation in

    http://www.zsh.org/mla/users/2009/msg00574.html

} I couldn't figure out any syntax for closing the p descriptor manually
} like you would do with exec 2>&-

Nothing about coproc has changed in 10 years, so:

    http://www.zsh.org/mla/users/1999/msg00619.html


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-29 23:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-29 19:19 coprocess file descriptor p isn't closed after coprocess exits Mikael Magnusson
2009-07-29 23:46 ` Bart Schaefer

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