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

Re: exec >& >(tee hello)



On Mar 26,  3:21pm, Anthony Heading wrote:
}
} On zsh  (5.0 and 4.2.6 -   rhel5 x64),  this command hangs:
}       zsh -c 'exec >& >(tee hello)'
} It seems to work OK with bash.

Define "work".

Zsh is waiting for "tee hello" to finish.  It's part of the current
command line, and nothing was put in the background, so the current
command is in the foreground until all parts of it finish.  From a
job management perspective this is the same as

    { exec >& } | tee hello

Perhaps

    exec >& >(tee hello &)

is what you want?

(Older versions of zsh put >(...) entirely in the background rather
than treat them as a component of the command line, but that led to
race conditions and processes still running after the parent shell
exited and various other confusion.)

However, there does seem to be a signal-handling bug with your original
command.  When run in an interactive shell, it probably ought to be
possible to interrupt or suspend the >(...) once zsh gets to the point
of waiting for it, but that doesn't work.

Note that both bash and zsh will exit on a SIGPIPE if the tee is killed.



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