summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-23 22:20:23 +0800
committerruki <[email protected]>2021-01-23 22:20:23 +0800
commit0e11a96c4c81a4d3b61fd8c288af8183d72f72c6 (patch)
tree9dfdbc22ee844224bcb224c72c5d4aed6c010831
parent69469eb56d52ef19a23d82ec9bfd7f763de5b7a2 (diff)
try fix winos.cmdargv
-rw-r--r--core/src/xmake/io/file_close.c6
-rw-r--r--xmake/core/base/winos.lua2
2 files changed, 7 insertions, 1 deletions
diff --git a/core/src/xmake/io/file_close.c b/core/src/xmake/io/file_close.c
index 45dea00a9..2390b7fd4 100644
--- a/core/src/xmake/io/file_close.c
+++ b/core/src/xmake/io/file_close.c
@@ -65,6 +65,12 @@ tb_int_t xm_io_file_close(lua_State* lua)
}
#endif
+ // flush filter stream cache, TODO we should fix it in tbox/stream
+ if ((file->mode & TB_FILE_MODE_RW) == TB_FILE_MODE_RW && file->fstream)
+ {
+ if (!tb_stream_sync(file->file_ref, tb_false)) return tb_false;
+ }
+
// close file
tb_stream_clos(file->file_ref);
file->file_ref = tb_null;
diff --git a/xmake/core/base/winos.lua b/xmake/core/base/winos.lua
index 59c705708..5e64d200f 100644
--- a/xmake/core/base/winos.lua
+++ b/xmake/core/base/winos.lua
@@ -168,7 +168,7 @@ function winos.cmdargv(argv, key)
end
if argn > limit then
local argsfile = os.tmpfile(key or table.concat(argv, '')) .. ".args.txt"
- local f = io.open(argsfile, 'w')
+ local f = io.open(argsfile, 'w', {encoding = "ansi"})
if f then
-- we need split args file to solve `fatal error LNK1170: line in command file contains 131071 or more characters`
-- @see https://github.com/xmake-io/xmake/issues/812