Date:        Sun, 19 Nov 2023 07:40:00 +1000
    From:        Martin D Kealey <mar...@kurahaupo.gen.nz>
    Message-ID:  
<CAN_U6MUEBHJyCWvuBS3Zd7dD=v2ensqera8z9t-d4ruzwh-...@mail.gmail.com>

  | The fact that you don't *want* the output of xclip connected to tr
  | (because it makes tr wait for xclip *and all its children* to finish,
  | while the shell waits for tr to finish) does not make zsh "correct".

It all depends upon the definition of what is supposed to happen
to the stdout of a process created as a process substitution
which is to read from its stdin (as in the example in question)
or what it should do with its stdin if intended to write output
through the named pipe or whatever.

Since process substitution is not a standardised feature, every
shell is able to decide for itself, and others are free to
express opinions about which they feel is better (more useful).
"Correct" is not the appropriate term to use.

Personally, just as a background process created in a non
job control context gets its stdin altered to /dev/null
(it shouldn't read from there, but just in case it does)
I'd think it generally better to redirect the unused
stdin or stdout (whichever is not connected to the invoking
process via the fifo, or whatever) be similarly redirected
to /dev/null, so output it should not be producing doesn't
corrupt the real output, and other processes aren't, like
here, left hanging waiting for potential output from that
process that is never going to come.

In the unusual case where this default redirect isn't wanted,
an explicit redirect can always be used to override it.

kre

  • Command hang... dbarrett--- via Bug reports for the GNU Bourne Again SHell
    • Re: Com... Greg Wooledge
      • Re:... Andreas Schwab
      • Re:... Daniel Barrett via Bug reports for the GNU Bourne Again SHell
        • ... Andreas Schwab
    • Re: Com... Martin D Kealey
    • Re: Com... Robert Elz

Reply via email to