summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-22 08:01:39 +0800
committerTitanSnow <[email protected]>2017-05-22 08:01:39 +0800
commit8e5973554fcb4ec070bb6e6002bc40bd4f950a6e (patch)
treed6295254ff8b8170560d31daf7cb7b89f134888e
parent8c19b03d8e54adc58ffccfb0e3c8db89b38d1a20 (diff)
new stdout & stderr redirect file open mode
TB_FILE_MODE_WO | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT do not remove exists
-rw-r--r--core/src/xmake/process/open.c12
-rw-r--r--core/src/xmake/process/openv.c12
2 files changed, 12 insertions, 12 deletions
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