Default app exit code to 0

This commit is contained in:
Samuel Attard 2016-08-30 13:30:56 +10:00
parent b5dec9990e
commit adf9acc468
No known key found for this signature in database
GPG key ID: 273DC1869D8F13EF
3 changed files with 8 additions and 5 deletions

View file

@ -48,7 +48,10 @@ void Browser::Quit() {
window_list->CloseAllWindows(); window_list->CloseAllWindows();
} }
void Browser::Exit(int code) { void Browser::Exit(mate::Arguments* args) {
int code = 0;
args->GetNext(&code);
if (!AtomBrowserMainParts::Get()->SetExitCode(code)) { if (!AtomBrowserMainParts::Get()->SetExitCode(code)) {
// Message loop is not ready, quit directly. // Message loop is not ready, quit directly.
exit(code); exit(code);

View file

@ -46,7 +46,7 @@ class Browser : public WindowListObserver {
void Quit(); void Quit();
// Exit the application immediately and set exit code. // Exit the application immediately and set exit code.
void Exit(int code); void Exit(mate::Arguments* args);
// Cleanup everything and shutdown the application gracefully. // Cleanup everything and shutdown the application gracefully.
void Shutdown(); void Shutdown();

View file

@ -305,11 +305,11 @@ This method guarantees that all `beforeunload` and `unload` event handlers are
correctly executed. It is possible that a window cancels the quitting by correctly executed. It is possible that a window cancels the quitting by
returning `false` in the `beforeunload` event handler. returning `false` in the `beforeunload` event handler.
### `app.exit(exitCode)` ### `app.exit([exitCode])`
* `exitCode` Integer * `exitCode` Integer (optional)
Exits immediately with `exitCode`. Exits immediately with `exitCode`. `exitCode` defaults to 0.
All windows will be closed immediately without asking user and the `before-quit` All windows will be closed immediately without asking user and the `before-quit`
and `will-quit` events will not be emitted. and `will-quit` events will not be emitted.