summaryrefslogtreecommitdiff
path: root/xmake/core/base/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-25 08:58:52 +0800
committerruki <[email protected]>2016-05-25 08:58:52 +0800
commit7545edd1693c3daa4ce9b8ac5ccba200c6858b61 (patch)
treec7bc4a263e924bc6fb1448a5cb834c2b7a6deea6 /xmake/core/base/os.lua
parentc5606b9bc54e3630898554f61fc191073506591b (diff)
check object name conflicts
Diffstat (limited to 'xmake/core/base/os.lua')
-rw-r--r--xmake/core/base/os.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index ab073e914..bb73b6c43 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -264,6 +264,25 @@ function os.run(cmd)
return true
end
+-- run shell with io
+function os.iorun(cmd)
+
+ -- make temporary data file
+ local datafile = path.join(os.tmpdir(), "xmake.os.iorun.data")
+
+ -- run command
+ local ok = os.execute(cmd .. string.format(" > %s 2>&1", datafile))
+
+ -- get results
+ local results = io.readall(datafile)
+
+ -- remove the temporary data file
+ os.rm(datafile)
+
+ -- ok?
+ return ok == 0, results
+end
+
-- run shell with coroutine
function os.corun(cmd)