summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-31 20:18:34 +0800
committerruki <[email protected]>2016-05-31 20:18:34 +0800
commita976651039f008aa7e0e7ec6cfee57bfb2aea6fa (patch)
treeee79d06f607042c95c11e84bad519677be414ddb /xmake/core/sandbox/modules/os.lua
parent5769dba5932aad3a97c8db36c80a15064b71f556 (diff)
impl macro plugin
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index df2093f9f..923cc5852 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -216,7 +216,20 @@ function sandbox_os.corun(cmd, ...)
end
end
--- execute shell
+-- execute shell
+function sandbox_os.exec(cmd, ...)
+
+ -- make command
+ cmd = vformat(cmd, ...)
+
+ -- run it
+ local retval = os.execute(cmd)
+ if retval ~= 0 then
+ os.raise("exec %s failed(%d)!", cmd, retval)
+ end
+end
+
+-- execute shell and return error code
function sandbox_os.execute(cmd, ...)
-- make command