Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

coprocess file descriptor p isn't closed after coprocess exits



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



Messages sorted by: Reverse Date, Date, Thread, Author