I have a Twisted application that involves auto-updates. To have it automatically restart after updating, I setup a post reactor shutdown event that respawns the application like so:
reactor.addSystemEventTrigger('after', 'shutdown', os.execv, executable, args)
reactor.callFromThread(reactor.stop)
This works fine on Windows, but on OS X the event never gets called. The logs show that the parameters are correct, and running os.execv with the same parameters outside of Twisted – os.execv('/usr/bin/open', ['/usr/bin/open', '-n', '/Applications/MyApp.app']) – works fine.
What could I be missing here?
It turns out the issue was with the execv call, not the Twisted event shutdown.. I changed the command to call my executable within the .app bundle instead of using open and got it working.