util.prosodyctl: Fix getpass() for new return values of os.execute() in Lua 5.2
authorMatthew Wild <mwild1@gmail.com>
Tue, 20 Mar 2018 16:07:50 +0000
changeset 8637 f6f62c92b642
parent 8636 8ec18a002c30
child 8638 47e3b8b6f17a
util.prosodyctl: Fix getpass() for new return values of os.execute() in Lua 5.2
util/prosodyctl.lua
--- a/util/prosodyctl.lua	Mon Mar 19 16:40:40 2018 +0000
+++ b/util/prosodyctl.lua	Tue Mar 20 16:07:50 2018 +0000
@@ -66,7 +66,10 @@
 end
 
 local function getpass()
-	local stty_ret = os.execute("stty -echo 2>/dev/null");
+	local stty_ret, _, status_code = os.execute("stty -echo 2>/dev/null");
+	if status_code then -- COMPAT w/ Lua 5.1
+		stty_ret = status_code;
+	end
 	if stty_ret ~= 0 then
 		io.write("\027[08m"); -- ANSI 'hidden' text attribute
 	end