diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/openssl.lua | 3 | ||||
-rw-r--r-- | util/prosodyctl.lua | 2 | ||||
-rw-r--r-- | util/time.lua | 8 |
3 files changed, 11 insertions, 2 deletions
diff --git a/util/openssl.lua b/util/openssl.lua index 757259f6..33234a7d 100644 --- a/util/openssl.lua +++ b/util/openssl.lua @@ -166,7 +166,8 @@ do -- Lua to shell calls. setmetatable(_M, { __index = function(_, command) return function(opts) - return 0 == os_execute(serialize(command, type(opts) == "table" and opts or {})); + local ret = os_execute(serialize(command, type(opts) == "table" and opts or {})); + return ret == true or ret == 0; end; end; }); diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua index cde1cdd4..7c9a3c19 100644 --- a/util/prosodyctl.lua +++ b/util/prosodyctl.lua @@ -44,7 +44,7 @@ end local function getchar(n) local stty_ret = os.execute("stty raw -echo 2>/dev/null"); local ok, char; - if stty_ret == 0 then + if stty_ret == true or stty_ret == 0 then ok, char = pcall(io.read, n or 1); os.execute("stty sane"); else diff --git a/util/time.lua b/util/time.lua new file mode 100644 index 00000000..84cff877 --- /dev/null +++ b/util/time.lua @@ -0,0 +1,8 @@ +-- Import gettime() from LuaSocket, as a way to access high-resolution time +-- in a platform-independent way + +local socket_gettime = require "socket".gettime; + +return { + now = socket_gettime; +} |