summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-05 16:37:41 +0800
committerruki <[email protected]>2016-07-05 16:37:41 +0800
commit7af1dcdeed9e2ecbfc0ba0f4c34e52c99e1cdd89 (patch)
tree5d8b2b77ddca5024f350093f882c93a03f7a69e9 /xmake/core/sandbox/modules/os.lua
parent7f75b2583b94e733ba0b974860174a9021bc8767 (diff)
uses os.exec instead of os.execute
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua27
1 files changed, 15 insertions, 12 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 0c06d7dff..f4d6efb6e 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -208,6 +208,19 @@ function sandbox_os.run(cmd, ...)
end
end
+-- run shell with arguments list
+function sandbox_os.runv(shellname, argv)
+
+ -- make shellname
+ shellname = vformat(shellname)
+
+ -- run it
+ local ok, errors = os.runv(shellname, argv)
+ if not ok then
+ os.raise(errors)
+ end
+end
+
-- run shell with io
function sandbox_os.iorun(cmd, ...)
@@ -244,7 +257,7 @@ function sandbox_os.exec(cmd, ...)
cmd = vformat(cmd, ...)
-- run it
- local ok = os.execute(cmd)
+ local ok = os.exec(cmd)
if ok ~= 0 then
os.raise("exec(%s) failed(%d)!", cmd, ok)
end
@@ -259,20 +272,10 @@ function sandbox_os.execv(shellname, argv)
-- run it
local ok = os.execv(shellname, argv)
if ok ~= 0 then
- os.raise("execv(%s) failed(%d)!", shellname, ok)
+ os.raise("execv(%s %s) failed(%d)!", shellname, table.concat(argv, ' '), ok)
end
end
--- execute shell and return error code
-function sandbox_os.execute(cmd, ...)
-
- -- make command
- cmd = vformat(cmd, ...)
-
- -- run it
- return os.execute(cmd)
-end
-
-- match files or directories
function sandbox_os.match(pattern, findir, ...)