summaryrefslogtreecommitdiff
path: root/xmake/core/action/run.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-01-29 09:12:58 +0800
committerruki <[email protected]>2016-02-15 19:10:26 +0800
commitdef096cfe9e22d363dffa29cd02c134778e62966 (patch)
tree2d12e3ebdd9968cac0784e4ebe49bba0643a903d /xmake/core/action/run.lua
parentd76193bc445d3c81993a92fd897d3e3d93edeaf2 (diff)
load script in sandbox
Diffstat (limited to 'xmake/core/action/run.lua')
-rw-r--r--xmake/core/action/run.lua28
1 files changed, 16 insertions, 12 deletions
diff --git a/xmake/core/action/run.lua b/xmake/core/action/run.lua
index 247170d45..75978622b 100644
--- a/xmake/core/action/run.lua
+++ b/xmake/core/action/run.lua
@@ -29,6 +29,7 @@ local path = require("base/path")
local utils = require("base/utils")
local config = require("base/config")
local project = require("base/project")
+local sandbox = require("base/sandbox")
local platform = require("base/platform")
-- need access to the given file?
@@ -85,21 +86,24 @@ function action_run.done()
-- run script
local runscript = target.runscript
if runscript ~= nil then
- if type(runscript) == "function" then
-
- -- make passed target
- local target_passed = {}
- target_passed.name = name
- target_passed.arguments = arguments
- target_passed.targetfile = targetfile
- -- run it
- local ok = runscript(target_passed)
- if ok ~= 0 then return utils.ifelse(ok == 1, true, false) end
- else
- utils.error("invalid run script!")
+ -- make passed target
+ local target_passed = {}
+ target_passed.name = name
+ target_passed.arguments = arguments
+ target_passed.targetfile = targetfile
+
+ -- run script
+ local ok, results = sandbox.load(runscript, target_passed)
+ if not ok then
+ utils.error(results)
return false
end
+
+ -- check results
+ if results ~= 0 then
+ return utils.ifelse(results == 1, true, false)
+ end
end
-- not executale?