Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is it possible to capture stdout and stderr to separate variables in Zsh?
- X-seq: zsh-users 16857
- From: Nikolai Weibull <now@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Is it possible to capture stdout and stderr to separate variables in Zsh?
- Date: Wed, 7 Mar 2012 10:26:57 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=47M3ZWdvU9unnp76RbEi7T060GnJZcnDVVMVZe63Dj0=; b=P/SDSrbnJy857mvyCEckeriIUN3UZftUV8kUwFguv4nJObzx/1+5HemSNuy0C2GfEx dj7p8ZkP4g6YMx6/MN3WTh9kSs8doWUhVvmMaDDqGNDY4QMQvUPWRkRKnzUYhPV7GN2G gqxxnEUzKnQMgCJlOjkw4JACf43TgMydsNHxOTjyxEkXy6axxIJCvS4ayI5IAS/mokht xo8ubKbrz6UTCiEPLCL3f3r9EUvLisTPpyJB2+7stZWnojORMbjm82WTDZ27rwzqhm03 z9pNSTM/UbawqS5IdvRbqznAmCwp3xiaK8vn9MTGfeZbF69ueY2LkJH3u4Zk9AVXwK6s UWcw==
- In-reply-to: <120306230111.ZM11639@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADdV=Mtbszh2NjtB8yFjfeo9PR1U7XV-Qi2AQMXCZ0Ag0VTS+w@mail.gmail.com> <1331054185.27052.19.camel@air.fifi.org> <120306230111.ZM11639@torch.brasslantern.com>
- Sender: nikolai.weibull@xxxxxxxxx
On Wed, Mar 7, 2012 at 08:01, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> } On Tue, 2012-03-06 at 09:09 +0100, Nikolai Weibull wrote:
> } > Is it possible to capture stdout and stderr to separate variables in Zsh?
> You might also be able to do something with the zsh/zselect module, but
> just use a temp file. That solution works in bash, too.
Invoking two additional commands (mktemp and rm) is prohibitively
expensive on Cygwin for my use case. I used the following solution
instead:
outs=("${(@0):-"$({ out=$(x) } 2>&1; print $'\0'$out$'\0'$status)"}")
The indexes into outs are reversed in regard to the file descriptors,
but that’s not a big deal.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author