Search code examples
mozillaxpcomxulrunner

XulRunner exit code


I was wondering how someone can specify an exit code when shutting a XULRunner application.

I currently use nsIAppStartup.quit() described in MDC nsIAppStartup reference to shutdown the application, but I can't figure out how to specify a process exit code.

The application is launched from a shell script and this exit code is needed to decide if it should be restarted or not.

NOTE : Passing eRestart to the quit function is useless in my situation because restarting depends on factors external to the application (system limits etc.)

Thank you and any help would be appreciated.


Solution

  • A quick look at XRE_main function shows that it will only return a non-zero value in case of errors - and even then the exit code is fixed. If everything succeeds and the application shuts down normally the exit code will be 0, no way to change it. XULRunner isn't really meant to be used in shell scripts, you will have to indicate your result in some other way (e.g. by writing it to a file).