From: dana <dana@dana.is>
To: Zsh workers <zsh-workers@zsh.org>
Subject: [QUESTION] Inheritance of file descriptors in <( ... ) construct
Date: Fri, 25 May 2018 19:01:54 -0500 [thread overview]
Message-ID: <B78C1DFA-4925-473E-9A9F-DFF3695F2EEC@dana.is> (raw)
Hello,
I'm wondering about the following behaviour:
% ( fd=; exec {fd}>&2; : $( print foo >&$fd ) )
foo
% ( fd=; exec {fd}>&2; : =( print foo >&$fd ) )
foo
% ( fd=; exec {fd}>&2; : <( print foo >&$fd ) )
zsh: 12: bad file descriptor
As you can see, $fd (12) was inherited by the $( ... ) and =( ... ) constructs,
but not by the <( ... ) one.
Everything works as expected with FDs < 10, though:
% ( fd=9; exec 9>&2; : $( print foo >&$fd ) )
foo
% ( fd=9; exec 9>&2; : =( print foo >&$fd ) )
foo
% ( fd=9; exec 9>&2; : <( print foo >&$fd ) )
foo
Is this intended and/or desirable? Maybe something to do with the fact that
<( ... ) is itself exposed as a >=10 file descriptor? But it seems smart enough
not to re-use the number that $fd had (it uses 13 in this example), so...?
Cheers
dana
next reply other threads:[~2018-05-26 0:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-26 0:01 dana [this message]
2018-05-26 17:52 ` 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=B78C1DFA-4925-473E-9A9F-DFF3695F2EEC@dana.is \
--to=dana@dana.is \
--cc=zsh-workers@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).