From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: coprocess descriptor and error messages
Date: Fri, 17 Sep 2010 07:41:36 -0700 [thread overview]
Message-ID: <100917074136.ZM31402@torch.brasslantern.com> (raw)
In-Reply-To: <20100917094610.390f120f@pwslap01u.europe.root.pri>
On Sep 17, 9:46am, Peter Stephenson wrote:
}
} The question is whether it's useful to be able to test whether the
} coprocess is open at the same time as attempting to read or write.
Is there another obvious way to test whether the coprocess is open?
Aside: Should an interactive shell ever exit on SIGPIPE? Or maybe
a better question is, should a print to the coprocess ever cause an
un-trapped SIGPIPE?
schaefer[713] Src/zsh -f
torch% coproc repeat 8 read -E
[1] 31339
torch% repeat 10 { print -p; read -p }
schaefer[714] echo $?
141
} If so, doing it silently is reasonable. Otherwise it might be less
} mysterious to print "coprocess not open", or something like that,
} in both cases.
In looking further, the coprocess descriptor is reset to -1 only (and
immediately) by "read -p" detecting EOF on the coprocess output. So
in the "read" case, the invalid descriptor has always served as an
EOF flag. What should happen if the parent attempts to read after
an EOF has been seen? I would tend to think it should just get EOF
again, not produce a diagnostic, which is the current behavior.
However, ksh (at least pdksh) disagrees with me:
$ print -p
ksh: print: -p: no coprocess
$ read |&
[1] 31399
$ print -p
$ print -p
ksh: print: -p: no coprocess
[1] + Done read
$ read -p
$ read -p
ksh: read: -p: no coprocess
$ print -p
ksh: print: -p: no coprocess
$
Note, however, that it does NOT exit with SIGPIPE on "print -p".
next prev parent reply other threads:[~2010-09-17 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-17 5:04 Bart Schaefer
2010-09-17 8:46 ` Peter Stephenson
2010-09-17 14:41 ` Bart Schaefer [this message]
2010-09-17 16:11 ` 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=100917074136.ZM31402@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).