Allow me to clarify. Let's say that my helper scripts fall into three categories:
ones that have no need to clean up after themselves and thus have no need to detect bad events
ones that need to perform CleanUpX() routine on completion, regardless of how that completion is initiated (i.e. normal exit or a croak)
ones that need to perform CleanUpY() routine on completion, regardless of how that completion is initiated (i.e. normal exit or a croak)
As you can see, doing a single activity on the main script side is not an option. Each script has to clean up on their own, if needed. The question is how can I force the specific clean up in case of an abnormal exit (i.e. croak) of each helper script?