From ec70d377702ca8d0053fc652489d2dd43637e061 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 15 Jan 2016 00:51:01 +0000 Subject: prosody: Allow prosody.shutdown() to take an exit code for the process (thanks daurnimator) --- prosody | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'prosody') 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) -- cgit v1.2.3