Reminder: I need to better understand and then write up Bash traps specifically in conjunction with subshell interactions.
function trap_subshell {
if (( $BASH_SUBSHELL >= 1 )) ; then
kill $$
fi
}
set -o errtrace
trap trap_subshell ERR
...and coproc
stuff http://wiki.bash-hackers.org/syntax/keywords/coproc:
barf () {
echo "Hello world"
}
trap barf EXIT SIGINT
{ coproc { tee; } >&3; } 3>&1
exec 1<&${COPROC[1]}
echo "foo"
sleep 5
echo "bar"