Non-interactive shell leaves children running when signaled by TERM

Hello.

When I run

sh -c 'yes'

and then send SIGTERM to sh's pid, both sh and yes dies.

When I run

sh -c 'yes | sed "s/y/n/"'

and then send SIGTERM to sh's pid, sh dies but yes and sed remain running in background with init as the parent.

Why?

I bash man page is stated that when bash is interactive and it receives SIGHUP, it sends SIGHUP to all its child processes.

Is it possible to achieve something similar when shell is non-interactive (ie. kill all child processes upon delivery of signal before exit)?

Thank you.

---------- Post updated at 10:05 PM ---------- Previous update was at 08:35 PM ----------

So I've got answer for the first question. It's because in first case shell just call exec, so the signal is delivered to yes. But in the second case, sh do 2 x fork and 2 x exec and waits for the child processes.