From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23649-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id c398bd14 for ; Mon, 17 Sep 2018 21:01:59 +0000 (UTC) Received: (qmail 18749 invoked by alias); 17 Sep 2018 21:01:48 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23649 Received: (qmail 6067 invoked by uid 1010); 17 Sep 2018 21:01:48 -0000 X-Qmail-Scanner-Diagnostics: from mail-qt0-f172.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.216.172):SA:0(-1.9/5.0):. Processed in 3.293261 secs); 17 Sep 2018 21:01:48 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2CzhnzYRMTKyGzYXwA3xlzKJ+eEfqs0dNmsjAGguRzA=; b=eqmzQAvtqnFf+udgPaiU1Twj3s3osVMVwpl2wnnAN6AA+PgglYBoDZZeO5ZaYLn3zD s5U99UHVvznkRgzSfut7m9IfVsC1QyQh+NWXl59xdy1neW5vsxpZZ4zsAq+g9kKer5h7 MP34ICqo3pA4YMamG06mwonFlZLSI29i1w8F2osSC2uorv/d0/MtVJgfXUGYkPV4W+6V j1q1Pk1W1VH1/qnJx6UiItn2IYybGVHQgo8Lgmqf9888ChrJk2XYpBH3eAgSdK/Iw8FK T9kiR/i2TSLpfJL3vVZZRFx6avvEpqtGolDTky18qyv9i/gVxUm0te7hJ3ovH5ado5sq oo9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2CzhnzYRMTKyGzYXwA3xlzKJ+eEfqs0dNmsjAGguRzA=; b=Br4EUm7p3k2aTU8RWgOUnnNHLIMfKOX1zJQ3GHi9wfGMIoYW9lMx/uXU5ORbhBJo0O Ue+285oVZFWck5Dwfop4Js4p+JjBqalG+mbNBnroByn9BPuY4hvIs1W5mEeyfeNj2msj hqvsPAahHCIby2kZ1ErWvJrjcHnHvWAAaSAAp4eEJ46rLKXlCqWS4NLfFvrXx+3yAzQL DdWVGEPo23jyzLMttLUkxb2/oxCk/Id7vG66UZvbJh8Umt/yiw/jXHeMRx4fhvnhrf3B FNCS90uMkwpW9XH7Xth+W8aXx52FVB2+Lw1dSefeLIzyZCeo2BEo9ox9tlhh1lb+QeX1 KBnQ== X-Gm-Message-State: APzg51B++1daCt3N93VuS/IVLQi2HVzU/rEE+FiPUH5/dR6B++LBfBVQ DrUmDn5RQpn0vRsPNikpkMsq5qQ/Q8mHGbNwf+g= X-Google-Smtp-Source: ANB0VdaS8WHoWdmfuqhS0hTnPHEhO16/rdwdGl+eTkjZEtvepJrubkhctg9yIYNA8xXYKdq6EHks4eP4C37ZKbu8uds= X-Received: by 2002:a0c:885b:: with SMTP id 27-v6mr19193686qvm.115.1537218101220; Mon, 17 Sep 2018 14:01:41 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1537217203.28092.1511309952.71C4C11C@webmail.messagingengine.com> References: <04a12c6a-c926-b088-f386-8a2bdb81dad2@gmail.com> <20180903140214.76kbzgpfru6atc5u@tarpaulin.shahaf.local2> <20180903184353.yzujt7ywnlvufeye@gmail.com> <1537217203.28092.1511309952.71C4C11C@webmail.messagingengine.com> From: Mikael Magnusson Date: Mon, 17 Sep 2018 23:01:40 +0200 Message-ID: Subject: Re: Capturing STDOUT without subshells or file I/O To: Daniel Shahaf Cc: Ben Klein , Zsh Users Content-Type: text/plain; charset="UTF-8" On Mon, Sep 17, 2018 at 10:46 PM, Daniel Shahaf wrote: > Ben Klein wrote on Mon, 17 Sep 2018 16:13 -0400: >> So I guess the question is up again, how should I capture the `printf` >> output without the `-v` option, no subshells, and no file I/O? Is there >> a different method for ZSH v5.1? >> >> I would like to do `printf '%.2f' "3.4" | read var` but it appears that >> the command before the pipe causes a subshell to be opened. >> > > If you could call pipe(2), you'd be able to do > . > printf foo >&$w > read bar <&$r > . > without forking (where $r,$w were returned by pipe(2)). However, I > don't see any suitable callsite in the 5.6 codebase. (Don't have 5.1 > handy, sorry.) > > Maybe we should expose pipe(2) in zsh/system? That's just a deadlock-by-design. -- Mikael Magnusson