diff options
| author | ruki <[email protected]> | 2019-08-20 17:53:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-08-20 17:55:19 +0800 |
| commit | f0edb8798d3c425249792c735eec7655c5eb2b62 (patch) | |
| tree | 7e58f9b477c6fa7844c9f6cef8260b453295aeb7 /xmake/modules/private/tools | |
| parent | b4aaf6ec3aa7d2d9d6f21f267a46869d25275d16 (diff) | |
improve file close
Diffstat (limited to 'xmake/modules/private/tools')
| -rw-r--r-- | xmake/modules/private/tools/vstool.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/modules/private/tools/vstool.lua b/xmake/modules/private/tools/vstool.lua index ba0ec8edc..83539d301 100644 --- a/xmake/modules/private/tools/vstool.lua +++ b/xmake/modules/private/tools/vstool.lua @@ -43,8 +43,8 @@ function runv(program, argv, opt) if ok ~= 0 then -- read errors - local outdata = io.readfile(outpath) - local errdata = io.readfile(errpath) + local outdata = os.isfile(outpath) and io.readfile(outpath) or nil + local errdata = os.isfile(errpath) and io.readfile(errpath) or nil local errors = errdata or "" if #errors:trim() == 0 then errors = outdata or "" @@ -92,8 +92,8 @@ function iorunv(program, argv, opt) -- get output and error data outfile:close() - local outdata = io.readfile(outpath) - local errdata = io.readfile(errpath) + local outdata = os.isfile(outpath) and io.readfile(outpath) or nil + local errdata = os.isfile(errpath) and io.readfile(errpath) or nil -- remove the temporary output and error file os.tryrm(outpath) |
