Changeset

10064:1acfd25cd507

prosodyctl: Fix extraction of interpreter from arg when additional arguments (fixes #1386) Interpreter goes into the lowest negative index. See http://www.lua.org/manual/5.2/manual.html#7
author Kim Alvefur <zash@zash.se>
date Sat, 29 Jun 2019 16:54:39 +0200
parents 10063:13ccc2f05007
children 10065:b399dca1273c
files prosodyctl
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/prosodyctl	Sun Jul 07 19:15:35 2019 +0200
+++ b/prosodyctl	Sat Jun 29 16:54:39 2019 +0200
@@ -222,7 +222,15 @@
 	end
 
 	--luacheck: ignore 411/ret
-	local ok, ret = prosodyctl.start(prosody.paths.source, arg[-1]);
+	local lua;
+	do
+		local i = 0;
+		repeat
+			i = i - 1;
+		until arg[i-1] == nil
+		lua = arg[i];
+	end
+	local ok, ret = prosodyctl.start(prosody.paths.source, lua);
 	if ok then
 		local daemonize = configmanager.get("*", "daemonize");
 		if daemonize == nil then