Software /
code /
prosody
Comparison
util/human/io.lua @ 12573:0f4feaf9ca64
util: Remove various Lua 5.1 compatibility hacks
Part of #1600
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Jul 2022 17:31:14 +0200 |
parent | 11897:e84ea5b58b29 |
child | 12783:d513e4bd4928 |
comparison
equal
deleted
inserted
replaced
12572:35a9ed6b7896 | 12573:0f4feaf9ca64 |
---|---|
28 return line; | 28 return line; |
29 end | 29 end |
30 end | 30 end |
31 | 31 |
32 local function getpass() | 32 local function getpass() |
33 local stty_ret, _, status_code = os.execute("stty -echo 2>/dev/null"); | 33 local stty_ret = os.execute("stty -echo 2>/dev/null"); |
34 if status_code then -- COMPAT w/ Lua 5.1 | |
35 stty_ret = status_code; | |
36 end | |
37 if stty_ret ~= 0 then | 34 if stty_ret ~= 0 then |
38 io.write("\027[08m"); -- ANSI 'hidden' text attribute | 35 io.write("\027[08m"); -- ANSI 'hidden' text attribute |
39 end | 36 end |
40 local ok, pass = pcall(io.read, "*l"); | 37 local ok, pass = pcall(io.read, "*l"); |
41 if stty_ret == 0 then | 38 if stty_ret == 0 then |