aboutsummaryrefslogtreecommitdiffstats
path: root/prosody
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2016-01-15 00:51:01 +0000
committerMatthew Wild <mwild1@gmail.com>2016-01-15 00:51:01 +0000
commitebf69f75702f72947056cdfd706601c7f69f830e (patch)
treecf57d7765fa58d042fab0ac7244dd5d767eb7b4e /prosody
parent3a457689812fcf760832db7ebee7158787b7fbbb (diff)
downloadprosody-ebf69f75702f72947056cdfd706601c7f69f830e.tar.gz
prosody-ebf69f75702f72947056cdfd706601c7f69f830e.zip
prosody: Allow prosody.shutdown() to take an exit code for the process (thanks daurnimator)
Diffstat (limited to 'prosody')
-rwxr-xr-xprosody9
1 files changed, 7 insertions, 2 deletions
diff --git a/prosody b/prosody
index a2cb0e6c..6a3b50db 100755
--- a/prosody
+++ b/prosody
@@ -272,10 +272,14 @@ function init_global_state()
end
-- Function to initiate prosody shutdown
- function prosody.shutdown(reason)
+ function prosody.shutdown(reason, code)
log("info", "Shutting down: %s", reason or "unknown reason");
prosody.shutdown_reason = reason;
- prosody.events.fire_event("server-stopping", {reason = reason});
+ prosody.shutdown_code = code;
+ prosody.events.fire_event("server-stopping", {
+ reason = reason;
+ code = code;
+ });
server.setquitting(true);
end
end
@@ -418,3 +422,4 @@ cleanup();
prosody.events.fire_event("server-stopped");
log("info", "Shutdown complete");
+os.exit(prosody.shutdown_code)