diff options
| -rw-r--r-- | core/src/xmake/io/file_close.c | 3 | ||||
| -rw-r--r-- | xmake/modules/private/tools/vstool.lua | 8 |
2 files changed, 5 insertions, 6 deletions
diff --git a/core/src/xmake/io/file_close.c b/core/src/xmake/io/file_close.c index 5c7d5c75d..6b3efdd98 100644 --- a/core/src/xmake/io/file_close.c +++ b/core/src/xmake/io/file_close.c @@ -66,8 +66,7 @@ tb_int_t xm_io_file_close(lua_State* lua) #endif // close file - if (!tb_stream_clos(file->file_ref)) - xm_io_file_return_error(lua, "failed to close file"); + tb_stream_clos(file->file_ref); file->file_ref = tb_null; // exit fstream 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) |
