From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23293 invoked by alias); 14 Nov 2015 22:47:43 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37114 Received: (qmail 5983 invoked from network); 14 Nov 2015 22:47:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:to:subject:mime-version :content-type; bh=OwjE67en8L8etDKDLwvMQAZp8rLFaMuZcbiuAM2Cu7I=; b=Vs3uKk/d6/qoQ7IUoccSAgL/izuqTjbmOWcLCnDH55EFipiDEqbnoHrrHq33HY2RHK QgXo8z7CIMgPuIiohkLTXJ0ecJnOlK10j2UsMdJadZLMUHYXCGVwrZmkicjeHlA5smuJ Koj2v+oOcTVMvhumbNGVrKE7XPePP8g0JZP3FqyzwXzXKEv7qDgLVKFumNyF0foHfdb1 TTWf7yMKI5vqBjwBfP6/zhJYlfnyLQTIlSAn9oMnyHveepKyuLG3R+LUs1C5XyiUEDk8 NrsWyTcGWFRRXP69mZDH+pKB76TGtdu3N6PnrDHUKjRqZIGmd+Jw6w/SRglDkeMlv7Yf Pwgg== X-Gm-Message-State: ALoCoQlxKKEI9xoccch6fhXiu4v8Wrr5bUW/8G6C+RokxtK+CgunZdzDlUazAUkzcdPzFxZDknC5 X-Received: by 10.182.210.234 with SMTP id mx10mr17124077obc.47.1447541260343; Sat, 14 Nov 2015 14:47:40 -0800 (PST) From: Bart Schaefer Message-Id: <151114144737.ZM1845@torch.brasslantern.com> Date: Sat, 14 Nov 2015 14:47:37 -0800 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Is this a deadlock waiting to happen? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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?