lua-posix/luaposix-lua-5.2.patch
2013-05-12 21:47:46 -04:00

41 lines
1.3 KiB
Diff

diff -up luaposix-8f8058293efd9654e5fc7f7627a04f4db2b56f8f/posix.lua.lua-52 luaposix-8f8058293efd9654e5fc7f7627a04f4db2b56f8f/posix.lua
--- luaposix-8f8058293efd9654e5fc7f7627a04f4db2b56f8f/posix.lua.lua-52 2013-05-12 21:37:05.201524376 -0400
+++ luaposix-8f8058293efd9654e5fc7f7627a04f4db2b56f8f/posix.lua 2013-05-12 21:43:12.845548551 -0400
@@ -4,6 +4,27 @@ local posix = M
local bit
if _VERSION == "Lua 5.1" then bit = require "bit" else bit = require "bit32" end
+-- Code extracted from lua-stdlib with minimal modifications
+local list = {
+ sub = function (l, from, to)
+ local r = {}
+ local len = #l
+ from = from or 1
+ to = to or len
+ if from < 0 then
+ from = from + len + 1
+ end
+ if to < 0 then
+ to = to + len + 1
+ end
+ for i = from, to do
+ table.insert (r, l[i])
+ end
+ return r
+ end
+}
+-- end of stdlib code
+
--- Create a file.
-- @param file name of file to create
-- @param mode permissions with which to create file
@@ -30,7 +51,7 @@ function M.spawn (task, ...)
task = {"/bin/sh", "-c", task, ...}
end
if type (task) == "table" then
- posix.execp (unpack (task))
+ posix.execp (table.unpack (task))
-- Only get here if there's an error; kill the fork
local _, no = posix.errno ()
posix._exit (no)