I'm using VSCode for developing and came to the point when I need to do something before the script stops. I added an exit handler on exit and SIGUSR1, but none of them actually trigger when I'm using the debug feature and pressing stop/restart there.
How can I do something when VSCode debugger stops/restarts the script? (Both JS and Python answers are acceptable).
I'm using process.on() in node.js and signal.signal() and atexit in Python.