Diff

prosodyctl @ 8701:b7a22baaf55f

prosodyctl: Increase robustness in luarocks version detection (fixes #1003)
author Kim Alvefur <zash@zash.se>
date Fri, 30 Mar 2018 12:12:50 +0200
parent 8671:a4899174a894
child 8718:c23cdeac5b61
line wrap: on
line diff
--- a/prosodyctl	Thu Mar 29 16:57:18 2018 +0200
+++ b/prosodyctl	Fri Mar 30 12:12:50 2018 +0200
@@ -376,9 +376,15 @@
 		print("  "..path);
 	end
 	print("");
-	local luarocks_status = (pcall(require, "luarocks.loader") and "Installed ("..(package.loaded["luarocks.cfg"].program_version or "2.x+")..")")
-		or (pcall(require, "luarocks.require") and "Installed (1.x)")
-		or "Not installed";
+	local luarocks_status = "Not installed"
+	if pcall(require, "luarocks.loader") then
+		luarocks_status = "Installed (2.x+)";
+		if package.loaded["luarocks.cfg"] then
+			luarocks_status = "Installed ("..(package.loaded["luarocks.cfg"].program_version or "2.x+")..")";
+		end
+	elseif pcall(require, "luarocks.require") then
+		luarocks_status = "Installed (1.x)";
+	end
 	print("LuaRocks:        ", luarocks_status);
 	print("");
 	print("# Lua module versions");