summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-04 23:59:59 +0800
committerruki <[email protected]>2016-07-04 23:59:59 +0800
commit1589758d311b92b6e19592768613ebd773bb94f0 (patch)
tree4071c7a178978bf39b246e7b84f38cfabae69381 /xmake/core/sandbox/modules/os.lua
parent0bb5ee3e8b5ee719c1bada87be11baca81722afd (diff)
add os.execv
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index c8341a160..0c06d7dff 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -244,9 +244,22 @@ function sandbox_os.exec(cmd, ...)
cmd = vformat(cmd, ...)
-- run it
- local retval = os.execute(cmd)
- if retval ~= 0 then
- os.raise("exec %s failed(%d)!", cmd, retval)
+ local ok = os.execute(cmd)
+ if ok ~= 0 then
+ os.raise("exec(%s) failed(%d)!", cmd, ok)
+ end
+end
+
+-- execute shell with arguments list
+function sandbox_os.execv(shellname, argv)
+
+ -- make shellname
+ shellname = vformat(shellname)
+
+ -- run it
+ local ok = os.execv(shellname, argv)
+ if ok ~= 0 then
+ os.raise("execv(%s) failed(%d)!", shellname, ok)
end
end