diff options
| author | ruki <[email protected]> | 2019-08-18 20:46:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-08-18 20:47:21 +0800 |
| commit | 35e6c625a2279a9c6adfdba1027b27d088b3c8b6 (patch) | |
| tree | 1ee4f7e1d6bf40a445225571fbb699ae79ee9de6 | |
| parent | eb6a3e93dae0deaa411f88a06ea9c46d75b501dc (diff) | |
improve to open filelock and process
| -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 |
