zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: coprocess file descriptor p isn't closed after coprocess exits
Date: Wed, 29 Jul 2009 21:19:03 +0200	[thread overview]
Message-ID: <237967ef0907291219m2cce3c52p2043dfc3d64c8cc8@mail.gmail.com> (raw)

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


             reply	other threads:[~2009-07-29 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 19:19 Mikael Magnusson [this message]
2009-07-29 23:46 ` Bart Schaefer

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=237967ef0907291219m2cce3c52p2043dfc3d64c8cc8@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=zsh-workers@sunsite.dk \
    /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).