summaryrefslogtreecommitdiff
path: root/core/src/xmake/process
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-16 00:52:24 +0800
committerruki <[email protected]>2019-08-15 23:14:26 +0800
commit28654b40d2095cb6f5eac816468c235849c1e1fe (patch)
treebf06f9e6d545a2eca4799514f44a928689e56d27 /core/src/xmake/process
parent9efdf1c2d98afdf4febb4d79bf3a0c39aa2e5eed (diff)
update tbox
Diffstat (limited to 'core/src/xmake/process')
-rw-r--r--core/src/xmake/process/open.c18
-rw-r--r--core/src/xmake/process/openv.c16
2 files changed, 18 insertions, 16 deletions
diff --git a/core/src/xmake/process/open.c b/core/src/xmake/process/open.c
index 3ade20733..3318f6017 100644
--- a/core/src/xmake/process/open.c
+++ b/core/src/xmake/process/open.c
@@ -34,7 +34,7 @@
* implementation
*/
-// p = process.open(command, outfile, errfile)
+// p = process.open(command, outpath, errpath)
tb_int_t xm_process_open(lua_State* lua)
{
// check
@@ -43,34 +43,34 @@ tb_int_t xm_process_open(lua_State* lua)
// get the command
size_t command_size = 0;
tb_char_t const* command = luaL_checklstring(lua, 1, &command_size);
- tb_char_t const* outfile = lua_tostring(lua, 2);
- tb_char_t const* errfile = lua_tostring(lua, 3);
+ tb_char_t const* outpath = lua_tostring(lua, 2);
+ tb_char_t const* errpath = lua_tostring(lua, 3);
tb_check_return_val(command, 0);
// init attributes
tb_process_attr_t attr = {0};
// redirect stdout?
- if (outfile)
+ if (outpath)
{
// redirect stdout to file
- attr.outfile = outfile;
+ attr.outpath = outpath;
attr.outmode = TB_FILE_MODE_RW | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT;
+ attr.outtype = TB_PROCESS_REDIRECT_TYPE_FILEPATH;
}
// redirect stderr?
- if (errfile)
+ if (errpath)
{
// redirect stderr to file
- attr.errfile = errfile;
+ attr.errpath = errpath;
attr.errmode = TB_FILE_MODE_RW | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT;
+ attr.errtype = TB_PROCESS_REDIRECT_TYPE_FILEPATH;
}
// init process
tb_process_ref_t process = (tb_process_ref_t)tb_process_init_cmd(command, &attr);
if (process) lua_pushlightuserdata(lua, (tb_pointer_t)process);
else lua_pushnil(lua);
-
- // ok
return 1;
}
diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c
index d5539512a..92e552783 100644
--- a/core/src/xmake/process/openv.c
+++ b/core/src/xmake/process/openv.c
@@ -34,7 +34,7 @@
* implementation
*/
-// p = process.openv(shellname, argv, outfile, errfile, envs)
+// p = process.openv(shellname, argv, outpath, errpath, envs)
tb_int_t xm_process_openv(lua_State* lua)
{
// check
@@ -51,8 +51,8 @@ tb_int_t xm_process_openv(lua_State* lua)
// get the output and error file
tb_char_t const* shellname = lua_tostring(lua, 1);
- tb_char_t const* outfile = lua_tostring(lua, 3);
- tb_char_t const* errfile = lua_tostring(lua, 4);
+ tb_char_t const* outpath = lua_tostring(lua, 3);
+ tb_char_t const* errpath = lua_tostring(lua, 4);
tb_check_return_val(shellname, 0);
// get environments
@@ -137,19 +137,21 @@ tb_int_t xm_process_openv(lua_State* lua)
if (envn > 0) attr.envp = envs;
// redirect stdout?
- if (outfile)
+ if (outpath)
{
// redirect stdout to file
- attr.outfile = outfile;
+ attr.outpath = outpath;
attr.outmode = TB_FILE_MODE_RW | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT;
+ attr.outtype = TB_PROCESS_REDIRECT_TYPE_FILEPATH;
}
// redirect stderr?
- if (errfile)
+ if (errpath)
{
// redirect stderr to file
- attr.errfile = errfile;
+ attr.errpath = errpath;
attr.errmode = TB_FILE_MODE_RW | TB_FILE_MODE_TRUNC | TB_FILE_MODE_CREAT;
+ attr.errtype = TB_PROCESS_REDIRECT_TYPE_FILEPATH;
}
// init process