summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-19 23:16:19 +0800
committerruki <[email protected]>2020-02-19 13:37:57 +0800
commit83be106cb6ef6f55dc992f97afa938ffed231087 (patch)
treef36f4ad629249fcfbdd03cad3fdbcef0658667b1 /xmake/core/sandbox/modules/os.lua
parented49fcb8e77087a12b01cae2bb7841a75a25b0fc (diff)
impl trybuild/meson
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 038807745..71f77089a 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -424,6 +424,30 @@ function sandbox_os.execv(program, argv, opt)
return ok
end
+-- execute command and echo verbose info if [-v|--verbose] option is enabled
+function sandbox_os.vexec(cmd, ...)
+
+ -- echo command
+ if option.get("verbose") then
+ print(vformat(cmd, ...))
+ end
+
+ -- run it
+ sandbox_os.exec(cmd, ...)
+end
+
+-- execute command with arguments list and echo verbose info if [-v|--verbose] option is enabled
+function sandbox_os.vexecv(program, argv, opt)
+
+ -- echo command
+ if option.get("verbose") then
+ print(vformat(program) .. " " .. sandbox_os.args(argv))
+ end
+
+ -- run it
+ sandbox_os.execv(program, argv, opt)
+end
+
-- match files or directories
function sandbox_os.match(pattern, mode, callback)
return os.match(vformat(pattern), mode, callback)