summaryrefslogtreecommitdiff
path: root/xmake/core/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/main.lua')
-rw-r--r--xmake/core/main.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index 632165717..826a2c3d8 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -41,6 +41,7 @@ local project = require("project/project")
local localcache = require("cache/localcache")
local profiler = require("base/profiler")
local debugger = require("base/debugger")
+local sandbox = require("sandbox/sandbox")
-- init the option menu
local menu =
@@ -276,15 +277,27 @@ end
-- run thread
function main._run_thread(callinfo_str)
+
+ -- get callback info
local callinfo, errors = string.deserialize(callinfo_str)
if not callinfo then
return false, string.format("invalid thread callinfo, %s!", errors or "unknown")
end
local callback = callinfo.callback
- if callback then
- callback(callinfo.argv)
+ if not callback then
+ return false, string.format("no callback")
end
- return true
+
+ -- bind sandbox
+-- local sandbox_inst, errors = sandbox.new(callback, {
+-- filter = interp:filter(), rootdir = interp:rootdir(), namespace = interp:namespace()})
+ local sandbox_inst, errors = sandbox.new(callback)
+ if not sandbox_inst then
+ return false, errors
+ end
+
+ -- do callback
+ return sandbox.load(sandbox_inst:script(), table.unpack(callinfo.argv or {}))
end
-- the main entry function