Changeset

8668:31c5abd49dfe

prosodyctl, util.prosodyctl: Pass source path as a parameter instead of global variable
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Mar 2018 21:54:59 +0000
parents 8667:a05d36075c6a
children 8669:2aa85b0cd2b8
files prosodyctl util/prosodyctl.lua
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/prosodyctl	Thu Mar 22 21:47:16 2018 +0000
+++ b/prosodyctl	Thu Mar 22 21:54:59 2018 +0000
@@ -219,7 +219,7 @@
 		return 1;
 	end
 
-	local ok, ret = prosodyctl.start();
+	local ok, ret = prosodyctl.start(prosody.paths.source);
 	if ok then
 		local daemonize = config.get("*", "daemonize");
 		if daemonize == nil then
--- a/util/prosodyctl.lua	Thu Mar 22 21:47:16 2018 +0000
+++ b/util/prosodyctl.lua	Thu Mar 22 21:54:59 2018 +0000
@@ -24,8 +24,6 @@
 local print = print;
 local tonumber = tonumber;
 
-local CFG_SOURCEDIR = _G.CFG_SOURCEDIR;
-
 local _G = _G;
 local prosody = prosody;
 
@@ -231,7 +229,7 @@
 	return true, signal.kill(pid, 0) == 0;
 end
 
-local function start()
+local function start(source_dir)
 	local ok, ret = isrunning();
 	if not ok then
 		return ok, ret;
@@ -239,10 +237,10 @@
 	if ret then
 		return false, "already-running";
 	end
-	if not CFG_SOURCEDIR then
+	if not source_dir then
 		os.execute("./prosody");
 	else
-		os.execute(CFG_SOURCEDIR.."/../../bin/prosody");
+		os.execute(source_dir.."/../../bin/prosody");
 	end
 	return true;
 end