Hello,
The code in question is
set +m
echo $BASH_VERSION
echo $SHELLOPTS
trap 'echo =====SIGCHLD=====' 18
sleep 1
echo done
Bash 5 output:
5.0.17(1)-release
braceexpand:hashall:interactive-comments
=====SIGCHLD=====
done
Bash 4 output:
4.4.19(1)-release
braceexpand:hashall:interactive-comments
done
I was trying to find a relevant note in changelog and I found this in CHANGES:
n. The SIGCHLD trap is run once for each exiting child process even if job
control is not enabled when the shell is in Posix mode.
and this in CWRU/changelog:
- waitchld: run SIGCHLD trap for each child exited even if job control
is not enabled when in Posix mode. Prompted by an austin-group-l
discussion
I was trying to find the discussion and the closest thing I found was
https://www.mail-archive.com/[email protected]/msg00898.html
As a side note, another interesting bit I found is that if I replace the
'sleep 1' with 'read' I will not get SIGCHLD in bash 5.
My understanding is that this is intentional change, but I would like to
kindly ask if you could confirm it.
Thank you
--
Vlad