Re: Why does sysopen not assign the fd param in this case?

Mikael Magnusson <[email protected]> Thu, 18 Dec 2025 16:50:12 +0100
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAHYJk3QuvCTgj5v7M3n4QSBC87x_CqCOqWQf+THbiY_jovTgMQ@mail.gmail.com>
On Thu, Dec 18, 2025 at 3:05 PM Marlon Richert <[email protected]> wrote:
>
> Why doesn't sysopen assign the fd parameter during startup, yet it
> does assign it correctly on the command line afterwards?
>
> % cd $(mktemp -d)
> % > .zshrc <<EOF
> zmodload -F zsh/system b:sysopen
> PS1='%# '
> PS4=+
> set -x
> sysopen -r -o cloexec -u fd <( sleep 1 )
> print fd=$fd
> EOF
> % env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d
> +sysopen -r -o cloexec -u fd /dev/fd/12
> +print 'fd='
> fd=
> +sleep 1
> % sysopen -r -o cloexec -u fd <( sleep 1 ); print fd=$fd
> +sysopen -r -o cloexec -u fd /dev/fd/11
> +print 'fd=15'
> fd=15
> % +sleep 1

try cat .zshrc

-- 
Mikael Magnusson