Hi, not too long ago I could call os.exit([0 or 1]) and Corona would exit immediately no matter where the program counter was. However, now I notice Corona doesn’t exit immediately. I see the message “Feb 10 09:15:26.006: Simulation Terminated: Lua script called os.exit() with status: 0” but Corona itself will keep running through lua code until it reaches the end of a frame cycle. It does exit after a single cycle. Does anyone know why os.exit() isn’t being respected?
First, you should *never* call os.exit() in a real application. It’s an equivalent of a “force quit” or Ctrl+Alt+Del. That is not a good way to exit an application and can be interpreted as a crash by an app reviewer. The proper way to exit an app is via our native.requestExit() function instead, which won’t immediately exit the app, but it will close it gracefully. Also, if you’re targeting iOS and AppleTV, then your app is not allowed to exit itself either according to Apple’s guidelines or else your app may get rejected. Please review the following docs for more details…
https://docs.coronalabs.com/daily/api/library/os/exit.html
https://docs.coronalabs.com/daily/api/library/native/requestExit.html
Regarding the simulator, correct, it will not exit immediately. We explicitly block the real C function call that os.exit() is bound to. If we didn’t, then it would force quit the entire Corona Simulator app which is not what most Corona developers want it to do. So, this is the closest approximation we can do.
First, you should *never* call os.exit() in a real application. It’s an equivalent of a “force quit” or Ctrl+Alt+Del. That is not a good way to exit an application and can be interpreted as a crash by an app reviewer. The proper way to exit an app is via our native.requestExit() function instead, which won’t immediately exit the app, but it will close it gracefully. Also, if you’re targeting iOS and AppleTV, then your app is not allowed to exit itself either according to Apple’s guidelines or else your app may get rejected. Please review the following docs for more details…
https://docs.coronalabs.com/daily/api/library/os/exit.html
https://docs.coronalabs.com/daily/api/library/native/requestExit.html
Regarding the simulator, correct, it will not exit immediately. We explicitly block the real C function call that os.exit() is bound to. If we didn’t, then it would force quit the entire Corona Simulator app which is not what most Corona developers want it to do. So, this is the closest approximation we can do.