diff options
| author | ruki <[email protected]> | 2016-07-10 16:07:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-10 16:07:52 +0800 |
| commit | e281ea26c19103dcbc7f951a8592eeb6a1ff63a3 (patch) | |
| tree | b2ef3ea44478ad5d7ec5cf3f1a11e65213fd379b /xmake/core/sandbox/modules/os.lua | |
| parent | fd39adb3d959e605370098a72ec7e92b462fce62 (diff) | |
parse includes from cl.exe
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/os.lua | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua index f4d6efb6e..7486e5d25 100644 --- a/xmake/core/sandbox/modules/os.lua +++ b/xmake/core/sandbox/modules/os.lua @@ -166,6 +166,17 @@ function sandbox_os.tmpdir() return tmpdir end +-- get the temporary file +function sandbox_os.tmpfile() + + -- get it + local tmpfile = os.tmpfile() + assert(tmpfile) + + -- ok + return tmpfile +end + -- get the tools directory function sandbox_os.toolsdir() @@ -221,33 +232,36 @@ function sandbox_os.runv(shellname, argv) end end --- run shell with io +-- run shell and return output and error data function sandbox_os.iorun(cmd, ...) -- make command cmd = vformat(cmd, ...) -- run it - local ok, results = os.iorun(cmd) + local ok, outdata, errdata = os.iorun(cmd) if not ok then - os.raise(results) + os.raise(errdata) end -- ok - return results + return outdata, errdata end --- run shell with coroutine -function sandbox_os.corun(cmd, ...) +-- run shell and return output and error data +function sandbox_os.iorunv(shellname, argv) - -- make command - cmd = vformat(cmd, ...) + -- make shellname + shellname = vformat(shellname) -- run it - local ok, errors = os.corun(cmd) + local ok, outdata, errdata = os.iorunv(shellname, argv) if not ok then - os.raise(errors) + os.raise(errdata) end + + -- ok + return outdata, errdata end -- execute shell |
