diff options
| author | ruki <[email protected]> | 2016-07-03 14:37:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-03 14:37:40 +0800 |
| commit | f8ade101414a282cc67f6254458f28c50de55bac (patch) | |
| tree | 93e2d3cedb05200a36f61f5e226c61a37486aa36 | |
| parent | bde33e64c9c036589c6f13d94bf577509fceb28d (diff) | |
fix command line length limit for windows when call os.run
| -rw-r--r-- | xmake/core/base/os.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index b668647e2..41d291cef 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -258,8 +258,21 @@ function os.run(cmd) -- make temporary log file local log = path.join(os.tmpdir(), "xmake.os.run.log") - -- run command - if 0 ~= os.execute(cmd .. string.format(" > %s 2>&1", log)) then + -- open command + local p = process.open(cmd, log, log) + if nil == p then + return false, string.format("cannot run %s", cmd) + end + + -- wait process + local waitok, status = process.wait(p, -1) + + -- close process + process.close(p) + + -- ok? + local ok = utils.ifelse(waitok > 0, status, -1) + if ok ~= 0 then -- make errors local errors = io.readall(log) |
