Comparison

util/prosodyctl.lua @ 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
parent 8123:bd591c5fc1bf
child 8668:31c5abd49dfe
comparison
equal deleted inserted replaced
8633:8ec18a002c30 8634:f6f62c92b642
64 return line; 64 return line;
65 end 65 end
66 end 66 end
67 67
68 local function getpass() 68 local function getpass()
69 local stty_ret = os.execute("stty -echo 2>/dev/null"); 69 local stty_ret, _, status_code = os.execute("stty -echo 2>/dev/null");
70 if status_code then -- COMPAT w/ Lua 5.1
71 stty_ret = status_code;
72 end
70 if stty_ret ~= 0 then 73 if stty_ret ~= 0 then
71 io.write("\027[08m"); -- ANSI 'hidden' text attribute 74 io.write("\027[08m"); -- ANSI 'hidden' text attribute
72 end 75 end
73 local ok, pass = pcall(io.read, "*l"); 76 local ok, pass = pcall(io.read, "*l");
74 if stty_ret == 0 then 77 if stty_ret == 0 then