Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Is this a deadlock waiting to happen?
- X-seq: zsh-workers 37114
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Is this a deadlock waiting to happen?
- Date: Sat, 14 Nov 2015 14:47:37 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version:content-type; bh=OwjE67en8L8etDKDLwvMQAZp8rLFaMuZcbiuAM2Cu7I=; b=TF01180WiEuIhcxwNCtojdGk7bMZ8cjs/8NnqjeV0hPuI05w4nTHuzprdUyZGgUIoX ButBEdZHYgAhF8fMfBtTHfHiYTTVMCW5LeFOTESbHNcSQWxUXwTf2F/dTMenZYOKKxMZ cN7utZ51D8BztAlS+537wktIKt9oW4bc2dJUYfDLJn2VvCAx4xhzJtwf1uvP9hRDT7qO uk2EoRFi5YToTqlTSevRc7F1GE3JmVPyNoX76qX2u/mKLvK+w47hTEqACK1VPc6oK/B/ W0XUBuMP897cuUVQuHCF5MWjUM3WwRdLSWPKOEdq/whVASB5DowRCQGGOyeDDF6ZG3ur /Mnw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author