From: Mikael Magnusson <mikachu@gmail.com>
To: Nathan Dorfman <ndorfman@gmail.com>
Cc: Bart Schaefer <schaefer@brasslantern.com>, Zsh Users <zsh-users@zsh.org>
Subject: Re: Redirect a specific file descriptor to a pipe?
Date: Sat, 11 Mar 2017 01:17:29 +0100 [thread overview]
Message-ID: <CAHYJk3RhhXY6wGxTu5oQfbZBeBdh-JtOVEy4L9f5uCuff3RWWA@mail.gmail.com> (raw)
In-Reply-To: <CADgEyUu9Ds5kNMA-uLa0Fo4KHw6AKfC4r3dDqBJ--4rcPU9Lvw@mail.gmail.com>
On Sat, Mar 11, 2017 at 12:32 AM, Nathan Dorfman <ndorfman@gmail.com> wrote:
> On Fri, Mar 10, 2017 at 11:51 AM, Bart Schaefer
> <schaefer@brasslantern.com> wrote:
>> } In zsh, to avoid the multios effect, you can do:
>> }
>> } {strace -o /dev/fd/3 ./a.out 3>&1 > out.log 2> err.log} | less
>> }
>> } or disable multios (set +o multios).
>>
>> With multios and without the braces, out.log gets the a.out output
>> and less gets both the strace output and the a.out output, which is
>> actually what I meant to do (but might not be exactly what Nathan
>> wanted, in retrospect). Thanks for the correction.
>
> Thanks guys, this does actually answer my question, and makes sense
> now that I think about.
>
> I still think it might be useful to be able to pipe any fd, not just
> stdout, but I don't know if I can contrive a great example. Perhaps we
> can't redirect stdout because it's a curses program that needs direct
> terminal access, but we want to do something like this:
>
> strace -o /dev/fd/3 mutt 3>XXX
>
> Where instead of XXX, we want to send fd 3 to |xz or |ssh?
>
> Feel free to ignore me if you think I'm going off the deep end :)
you can in theory do this
whatever_command 5> >(pipe command here) 7> >(some other pipe here)
but now that i'm testing it, it seems to not complete when it should, eg
strace -o /dev/fd/7 =true 7>&1 | cat
immediately returns but
strace -o /dev/fd/7 =true 7> >(cat)
just hangs after printing the output
--
Mikael Magnusson
next prev parent reply other threads:[~2017-03-11 0:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 0:21 Nathan Dorfman
2017-03-10 2:04 ` Bart Schaefer
[not found] ` <170309180417.ZM14034__34042.4779606566$1489111700$gmane$org@torch.brasslantern.com>
2017-03-10 17:22 ` Stephane Chazelas
2017-03-10 18:51 ` Bart Schaefer
2017-03-10 23:32 ` Nathan Dorfman
2017-03-11 0:17 ` Mikael Magnusson [this message]
2017-03-11 2:24 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3RhhXY6wGxTu5oQfbZBeBdh-JtOVEy4L9f5uCuff3RWWA@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=ndorfman@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).