kripken/emscripten — pull request #116 by eclecticdave (2011-11-09 00:08:52+00:00)
Title: exit() throws uncaught exception

Hi,

I've created a minor modification which changes the exit() function in library.js to throw an object
containing the exit status instead of a text string. This is then caught in the 'callMain' function
and the status returned. IMHO this is a little more graceful than using an uncaught exception ;-)

I can't see a way to actually return the exit status via the v8 engine, so I settled for printing the status in the 'invoke run' section, just to prove it works. Obviously if you're calling run() yourself, you can do something more intelligent.