Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[QUESTION] Inheritance of file descriptors in <( ... ) construct
- X-seq: zsh-workers 42822
- From: dana <dana@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: [QUESTION] Inheritance of file descriptors in <( ... ) construct
- Date: Fri, 25 May 2018 19:01:54 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=B5vTLmIVeyFX8WHQD3k09XIWtTAmz9BlbCVF6nk4DVM=; b=BkXTuttS2st1lnEVT8XAs5HerRGy8J+fz3dMdNseHfkjPQoGOybn3PDCw998FQnQgB op2pErEQPX7Aob9vbDHwiyoYoFIyiUlAHUHhRsXSctCAKZQ2p2UWmN5vzC2BwPqIkXP7 BuffKqYrDwbJo85YPebQThfl/XUyXWuarHTNfsRWhtljyLp3BhrvKkxg7ywilxbxwNxL lt2yILvL7DOR+j2x/GYGHrdFj5zKt1PU595v3uqf5gXN0cz/eZ5q8fF+ooJL0rdvhyIp WKT5xqsdw5BdBwwirkXHpgqgJ/a104xKKp9QAYmohFofLwZQdv0sOu0t0wpKRg7+Hb7t gQVA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author