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

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



On Thu, Dec 18, 2025 at 3:05 PM Marlon Richert <marlon.richert@xxxxxxxxx> 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



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