From 8d8c6bd619ded1b202ebd19bda33bde475c4c37d Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Thu, 10 Jan 2019 14:57:26 +0100
Subject: 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 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'util')

diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua
index 5f0c4d12..9b627bde 100644
--- a/util/prosodyctl.lua
+++ b/util/prosodyctl.lua
@@ -229,7 +229,8 @@ local function isrunning()
 	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 @@ local function start(source_dir)
 		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
-- 
cgit v1.2.3