Changeset

7081:a22d6a46d2ed

prosody: Allow prosody.shutdown() to take an exit code for the process (thanks daurnimator)
author Matthew Wild <mwild1@gmail.com>
date Fri, 15 Jan 2016 00:51:01 +0000
parents 7080:6946c3d5645f
children 7082:8b590fc77d91
files prosody
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Tue Jan 12 01:13:57 2016 +0100
+++ b/prosody	Fri Jan 15 00:51:01 2016 +0000
@@ -272,10 +272,14 @@
 	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 @@
 prosody.events.fire_event("server-stopped");
 log("info", "Shutdown complete");
 
+os.exit(prosody.shutdown_code)