summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-13 00:28:10 +0800
committerruki <[email protected]>2021-05-13 00:28:10 +0800
commit0ef8c1bf8f4ec10407f298c04d038f0480d9d944 (patch)
tree406c74f720d0f6f741b1bf969e23070cf042978d
parent279b428e45a37f779a9a4ee520f9b2730fab0fc3 (diff)
improve sandbox
-rw-r--r--xmake/core/sandbox/sandbox.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/core/sandbox/sandbox.lua b/xmake/core/sandbox/sandbox.lua
index f7196a242..766e6061c 100644
--- a/xmake/core/sandbox/sandbox.lua
+++ b/xmake/core/sandbox/sandbox.lua
@@ -323,7 +323,10 @@ function sandbox.instance(script)
while level < 32 do
-- get scope
- local scope = getfenv(level)
+ local ok, scope = pcall(getfenv, level)
+ if not ok then
+ break;
+ end
if scope then
-- enable to read _SANDBOX
@@ -344,8 +347,6 @@ function sandbox.instance(script)
-- next
level = level + 1
end
-
- -- ok?
return instance
end