Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: <(...), >(...) and fds above 9



2019-07-02 13:12:35 +0000, Peter Stephenson:
> On Tue, 2019-07-02 at 13:20 +0100, Stephane Chazelas wrote:
> > 2019-07-02 09:59:36 +0100, Peter Stephenson:
> > Note that ksh93 marks the fds above 2 that are open with
> > exec (exec 7< file or exec {fd}< file) with close-on-exec
> > (independently of whether the exec is done in background or
> > not)
> 
> This will do that for file descriptors managed with varid or builtins from
> modules, though it doesn't change the behaviour for file descriptors
> managed directly by number.  I'm wondering if that's too traditional to
> be worth any pain of changing --- {fd} is a much more manageable
> interface.
[...]

Note that I was not suggesting that zsh should do the same. That
close-on-exec on ksh93 adds more confusion than it helps. No
other shell does it AFAIK. That means that you need to work
around it like:

exec 7<> some-file
...
cmd /dev/fd/7 7>&7

to work around it.

Or make sure to use

{
  ...
  cmd /dev/fd/7
  ...
} 7<> some-file

And not "exec".

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author