aboutsummaryrefslogtreecommitdiffstats
path: root/util/human
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-10-20 17:35:01 +0200
committerKim Alvefur <zash@zash.se>2022-10-20 17:35:01 +0200
commit1acd5e0474c00f29fa436eba61c7aceb65ed08dd (patch)
tree755ab9bef7c5c070b7870db1fca1bddc49fa8170 /util/human
parente2cff346410c57686478d68fabd96cf4247df927 (diff)
downloadprosody-1acd5e0474c00f29fa436eba61c7aceb65ed08dd.tar.gz
prosody-1acd5e0474c00f29fa436eba61c7aceb65ed08dd.zip
util.human.io: Fix handling of os.execute() return values in Lua 5.2+
Wrong part of Lua 5.1 compat removed in 0f4feaf9ca64
Diffstat (limited to 'util/human')
-rw-r--r--util/human/io.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/util/human/io.lua b/util/human/io.lua
index 4fce0e94..b272af71 100644
--- a/util/human/io.lua
+++ b/util/human/io.lua
@@ -8,7 +8,7 @@ end;
local function getchar(n)
local stty_ret = os.execute("stty raw -echo 2>/dev/null");
local ok, char;
- if stty_ret == true or stty_ret == 0 then
+ if stty_ret then
ok, char = pcall(io.read, n or 1);
os.execute("stty sane");
else
@@ -31,11 +31,11 @@ end
local function getpass()
local stty_ret = os.execute("stty -echo 2>/dev/null");
- if stty_ret ~= 0 then
+ if not stty_ret then
io.write("\027[08m"); -- ANSI 'hidden' text attribute
end
local ok, pass = pcall(io.read, "*l");
- if stty_ret == 0 then
+ if stty_ret then
os.execute("stty sane");
else
io.write("\027[00m");