Merge 0.10->trunk
authorMatthew Wild <mwild1@gmail.com>
Tue, 28 Jun 2016 13:54:43 +0000 (14:54 +0100)
committerMatthew Wild <mwild1@gmail.com>
Tue, 28 Jun 2016 13:54:43 +0000 (14:54 +0100)
util/openssl.lua
util/prosodyctl.lua
util/time.lua [new file with mode: 0644]

index 757259f66469d6a5fdfb879338fea06741d8cd50..33234a7d9feaf45184279deb39080714ea6752a8 100644 (file)
@@ -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;
        });
index cde1cdd4ce7b839d07648835c2948eeaf25dbcd7..7c9a3c19dcf7c0edb6ab95959627d197a429cb45 100644 (file)
@@ -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 (file)
index 0000000..84cff87
--- /dev/null
@@ -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;
+}