I'm trying to link a piece of code on application quit of autodesk Maya, using scriptJob. It works when you choose "don't save" or "cancel" in the maya save prompt window, but if you choose to save the file it does not work as expected. I'm using Maya 2019.3.
MGlobal::executeCommand("scriptJob -e \"quitApplication\" "MyCustomCommand\" -per;");
I'm trying to do this from a cpp plugin. But tried it from script editor as well.
The solution I found was to add the script job in the doIt part of the custom command. My guess it needs something to be loaded before it can latch on to the event.