diff options
| author | ruki <[email protected]> | 2025-11-10 21:00:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-10 21:00:21 +0800 |
| commit | 2c387895657ae13cd717d7f42f5baed5eb028a8e (patch) | |
| tree | 8f005a8dfc3272e9f027560e5e1b5881a7a8bc70 /core/src/xmake/process/open.c | |
| parent | 831447a51da0b094e08bb047247bf269a6e6cf71 (diff) | |
format more if-else codes in core
Diffstat (limited to 'core/src/xmake/process/open.c')
| -rw-r--r-- | core/src/xmake/process/open.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/core/src/xmake/process/open.c b/core/src/xmake/process/open.c index f0885719a..669e90ff1 100644 --- a/core/src/xmake/process/open.c +++ b/core/src/xmake/process/open.c @@ -68,8 +68,9 @@ tb_int_t xm_process_open(lua_State *lua) { // is detached? lua_pushstring(lua, "detach"); lua_gettable(lua, 2); - if (lua_toboolean(lua, -1)) + if (lua_toboolean(lua, -1)) { attr.flags |= TB_PROCESS_FLAG_DETACH; + } lua_pop(lua, 1); // get curdir @@ -161,9 +162,9 @@ tb_int_t xm_process_open(lua_State *lua) { // is string? if (lua_isstring(lua, -1)) { // add this environment value - if (envn + 1 < tb_arrayn(envs)) + if (envn + 1 < tb_arrayn(envs)) { envs[envn++] = lua_tostring(lua, -1); - else { + } else { // error lua_pushfstring(lua, "envs is too large(%d > %d) for process.openv", @@ -239,14 +240,16 @@ tb_int_t xm_process_open(lua_State *lua) { } // set the new environments - if (envn > 0) + if (envn > 0) { attr.envp = envs; + } // init process tb_process_ref_t process = (tb_process_ref_t)tb_process_init_cmd(command, &attr); - if (process) + if (process) { xm_lua_pushpointer(lua, (tb_pointer_t)process); - else + } else { lua_pushnil(lua); + } return 1; } |
