util.prosodyctl: Allow passing path to Lua runtime to the start() function
authorKim Alvefur <zash@zash.se>
Thu, 10 Jan 2019 14:57:26 +0100
changeset 9785 161411a41377
parent 9784 c7727c13260f
child 9786 d844e197eedf
util.prosodyctl: Allow passing path to Lua runtime to the start() function By default the shebang is used. Being able to override it is useful in cases where the shebang does not match the configured runtime.
util/prosodyctl.lua
--- a/util/prosodyctl.lua	Thu Jan 10 14:54:34 2019 +0100
+++ b/util/prosodyctl.lua	Thu Jan 10 14:57:26 2019 +0100
@@ -229,7 +229,8 @@
 	return true, signal.kill(pid, 0) == 0;
 end
 
-local function start(source_dir)
+local function start(source_dir, lua)
+	lua = lua and lua .. " " or "";
 	local ok, ret = isrunning();
 	if not ok then
 		return ok, ret;
@@ -238,9 +239,9 @@
 		return false, "already-running";
 	end
 	if not source_dir then
-		os.execute("./prosody");
+		os.execute(lua .. "./prosody");
 	else
-		os.execute(source_dir.."/../../bin/prosody");
+		os.execute(lua .. source_dir.."/../../bin/prosody");
 	end
 	return true;
 end