diff options
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/os.lua | 15 |
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 |
