Re: PATCH: make the W02 test not take a full minute on linux

Mikael Magnusson <[email protected]> Thu, 11 Jun 2026 22:24:14 +0200
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAHYJk3RLG=xr7iaapJNYD7g_HxE_qbSDfZn0eZTEuo16HwCJ+g@mail.gmail.com>
On Thu, Jun 11, 2026 at 10:00 PM Bart Schaefer
<[email protected]> wrote:
>
> On Thu, Jun 11, 2026 at 11:05 AM Bart Schaefer
> <[email protected]> wrote:
> >
> > % { [[ -t 0 ]] & print -u2 terminal } <>/dev/null
>
> Obviously a second & got dropped there somehow, so for completeness:
>
> % { [[ -t 0 ]] && print -u2 terminal } >/dev/null
> terminal
> % { [[ -t 0 ]] && print -u2 terminal } <>/dev/null
> %

<> just means open as read/write, it still only opens fd 0. My earlier
statement was slightly incorrect though because I had assumed it
opened only fd 1 and changed it to just a >, and added the </dev/null.
But in fact what I would have needed is <>/dev/null and >/dev/null. It
is much clearer to just use > 2> and <, since nobody is reading or
writing anyway. We need to close all three fds to have the test go
fast, so we need three redirection operators.

{ [[ -t 1 ]] && print -u2 terminal } <>/dev/null
terminal

-- 
Mikael Magnusson