bash hangs on tee(1) in pipeline
A small application of mine uses tee(1) in pipelines a lot to log the output of subshells. it very often hangs leaving a zombie process that is the parent of a tee(1) process. The ps -aef output for the tee(1) generally looks like this:
dougl 11469284 12517574 0 14:07:43 pts/8 0:00 tee /tmp//sh-np-4134995703
Typical use in this scenario is from within a function:
"${@}" 2>&1 | tee >(sed -n -e "s/^/${timestamp} ${caller} #### /g" -ep 2>&1 >> ${iss_log_file}) | (printf "${caller} " ; cat -)
The "${@}" are the args to the function and very often a pipeline itself.
Has anyone else experienced this? Is there a "natural" fix? (Think shell environment, configuration, or the like. Spawning a coprocess to keep an eye on such things is certainly possible, but seems wrong somehow.)
I'm on AIX 6.1. Bash is version 4.2.1.
Thanks.
,Doug
|