zsh-workers
 help / color / mirror / code / Atom feed
* Is this a deadlock waiting to happen?
@ 2015-11-14 22:47 Bart Schaefer
  2015-11-15 17:36 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2015-11-14 22:47 UTC (permalink / raw)
  To: zsh-workers

Ray wrote:

    body_list=( ${(@f)"$( highlight $filename )"} ) 2>&1 | read _err

I was surprised to find that both $body_list and $_err are set in the
current shell.  I had presumed that piping to read would cause the left
side to be forked and the right to be executed in the current shell.

And indeed if I change this to:

    body_list=( ${(@f)"$( highlight $filename )"} ) : 2>&1 | read _err

then both the assignment and the ":" command are forked off and only
$_err is available to the current shell.

In the former situation, is it not the case that if the output to stderr
is too large for the OS to buffer in the pipeline, zsh is going to be
deadlocked, because [in the example] "highlight" will be blocked writing
to stderr while zsh is blocked waiting to read stdout from $(...) ?

Where did we optimize out the fork?


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

end of thread, other threads:[~2015-11-15 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-14 22:47 Is this a deadlock waiting to happen? Bart Schaefer
2015-11-15 17:36 ` Peter Stephenson

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