Changeset

8634:f6f62c92b642

util.prosodyctl: Fix getpass() for new return values of os.execute() in Lua 5.2
author Matthew Wild <mwild1@gmail.com>
date Tue, 20 Mar 2018 16:07:50 +0000
parents 8633:8ec18a002c30
children 8635:47e3b8b6f17a
files util/prosodyctl.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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