Running code when a script exits

However, several people in this thread say C-g q should work. Note that C-g does not send a signal, you get the control character 7. If that is possible, a shell script wrapper would be overkill.

I just need to interrupt a script in an ordered way. I have an at_exit callback, but could be taking down a supervision tree orderly or whatever.