From 8e5973554fcb4ec070bb6e6002bc40bd4f950a6e Mon Sep 17 00:00:00 2001 From: TitanSnow Date: Mon, 22 May 2017 08:01:39 +0800 Subject: new stdout & stderr redirect file open mode TB_FILE_MODE_WO | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT do not remove exists --- core/src/xmake/process/open.c | 12 ++++++------ core/src/xmake/process/openv.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'core/src') diff --git a/core/src/xmake/process/open.c b/core/src/xmake/process/open.c index feb000a66..b7ce59f52 100644 --- a/core/src/xmake/process/open.c +++ b/core/src/xmake/process/open.c @@ -59,11 +59,11 @@ tb_int_t xm_process_open(lua_State* lua) { // redirect stdout to file attr.outfile = outfile; - attr.outmode = TB_FILE_MODE_RW | TB_FILE_MODE_CREAT | TB_FILE_MODE_APPEND; + attr.outmode = TB_FILE_MODE_WO | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT; // remove the outfile first - if (tb_file_info(outfile, tb_null)) - tb_file_remove(outfile); + // if (tb_file_info(outfile, tb_null)) + // tb_file_remove(outfile); } // redirect stderr? @@ -71,11 +71,11 @@ tb_int_t xm_process_open(lua_State* lua) { // redirect stderr to file attr.errfile = errfile; - attr.errmode = TB_FILE_MODE_RW | TB_FILE_MODE_CREAT | TB_FILE_MODE_APPEND; + attr.errmode = TB_FILE_MODE_WO | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT; // remove the errfile first - if (tb_file_info(errfile, tb_null)) - tb_file_remove(errfile); + // if (tb_file_info(errfile, tb_null)) + // tb_file_remove(errfile); } // init process diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c index 58ec42d61..3d813568e 100644 --- a/core/src/xmake/process/openv.c +++ b/core/src/xmake/process/openv.c @@ -101,11 +101,11 @@ tb_int_t xm_process_openv(lua_State* lua) { // redirect stdout to file attr.outfile = outfile; - attr.outmode = TB_FILE_MODE_RW | TB_FILE_MODE_CREAT | TB_FILE_MODE_APPEND; + attr.outmode = TB_FILE_MODE_WO | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT; // remove the outfile first - if (tb_file_info(outfile, tb_null)) - tb_file_remove(outfile); + // if (tb_file_info(outfile, tb_null)) + // tb_file_remove(outfile); } // redirect stderr? @@ -113,11 +113,11 @@ tb_int_t xm_process_openv(lua_State* lua) { // redirect stderr to file attr.errfile = errfile; - attr.errmode = TB_FILE_MODE_RW | TB_FILE_MODE_CREAT | TB_FILE_MODE_APPEND; + attr.errmode = TB_FILE_MODE_WO | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT; // remove the errfile first - if (tb_file_info(errfile, tb_null)) - tb_file_remove(errfile); + // if (tb_file_info(errfile, tb_null)) + // tb_file_remove(errfile); } // init process -- cgit v1.3.1