diff options
| -rw-r--r-- | xmake/core/sandbox/modules/io.lua | 9 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/process.lua | 18 |
2 files changed, 9 insertions, 18 deletions
diff --git a/xmake/core/sandbox/modules/io.lua b/xmake/core/sandbox/modules/io.lua index 54f374a14..ca6f29ee4 100644 --- a/xmake/core/sandbox/modules/io.lua +++ b/xmake/core/sandbox/modules/io.lua @@ -169,13 +169,10 @@ function sandbox_io.openlock(filepath) -- hook filelock interfaces local hooked = {} - for name, func in pairs(lock) do + for name, func in pairs(sandbox_io_filelock) do if not name:startswith("_") and type(func) == "function" then - local newfunc = sandbox_io_filelock[name] - if newfunc ~= nil then - hooked["_" .. name] = lock["_" .. name] or func - hooked[name] = newfunc - end + hooked["_" .. name] = lock["_" .. name] or lock[name] + hooked[name] = func end end for name, func in pairs(hooked) do diff --git a/xmake/core/sandbox/modules/process.lua b/xmake/core/sandbox/modules/process.lua index 7bfb8ef5d..6fbcaf40b 100644 --- a/xmake/core/sandbox/modules/process.lua +++ b/xmake/core/sandbox/modules/process.lua @@ -67,13 +67,10 @@ function sandbox_process.open(command, opt) -- hook subprocess interfaces local hooked = {} - for name, func in pairs(proc) do + for name, func in pairs(sandbox_process_subprocess) do if not name:startswith("_") and type(func) == "function" then - local newfunc = sandbox_process_subprocess[name] - if newfunc ~= nil then - hooked["_" .. name] = proc["_" .. name] or func - hooked[name] = newfunc - end + hooked["_" .. name] = proc["_" .. name] or proc[name] + hooked[name] = func end end for name, func in pairs(hooked) do @@ -104,13 +101,10 @@ function sandbox_process.openv(filename, argv, opt) -- hook subprocess interfaces local hooked = {} - for name, func in pairs(proc) do + for name, func in pairs(sandbox_process_subprocess) do if not name:startswith("_") and type(func) == "function" then - local newfunc = sandbox_process_subprocess[name] - if newfunc ~= nil then - hooked["_" .. name] = proc["_" .. name] or func - hooked[name] = newfunc - end + hooked["_" .. name] = proc["_" .. name] or proc[name] + hooked[name] = func end end for name, func in pairs(hooked) do |
