diff options
| author | ruki <[email protected]> | 2020-03-23 21:00:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-23 00:04:45 +0800 |
| commit | 32d75762f2fe48cf413132d935d0834d7e3d5e6e (patch) | |
| tree | fcb42ea974c913c162c609877d4832707a2c65c0 | |
| parent | 5b1a9e54c3d97e08df6402baf22f528cf47ef1ae (diff) | |
update process
| -rw-r--r-- | core/src/xmake/process/open.c | 7 | ||||
| -rw-r--r-- | core/src/xmake/process/openv.c | 7 | ||||
| -rw-r--r-- | xmake/core/base/os.lua | 3 | ||||
| -rw-r--r-- | xmake/core/base/process.lua | 21 | ||||
| -rw-r--r-- | xmake/core/main.lua | 4 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/base/process.lua | 5 |
6 files changed, 14 insertions, 33 deletions
diff --git a/core/src/xmake/process/open.c b/core/src/xmake/process/open.c index 5ab60957a..365876047 100644 --- a/core/src/xmake/process/open.c +++ b/core/src/xmake/process/open.c @@ -62,6 +62,13 @@ tb_int_t xm_process_open(lua_State* lua) tb_pipe_file_ref_t errpipe = tb_null; if (lua_istable(lua, 2)) { + // is detached? + lua_pushstring(lua, "detach"); + lua_gettable(lua, 2); + if (lua_toboolean(lua, -1)) + attr.flags |= TB_PROCESS_FLAG_DETACH; + lua_pop(lua, 1); + // get outpath lua_pushstring(lua, "outpath"); lua_gettable(lua, 2); diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c index 69557aa69..2eeb35491 100644 --- a/core/src/xmake/process/openv.c +++ b/core/src/xmake/process/openv.c @@ -104,6 +104,13 @@ tb_int_t xm_process_openv(lua_State* lua) tb_pipe_file_ref_t errpipe = tb_null; if (lua_istable(lua, 3)) { + // is detached? + lua_pushstring(lua, "detach"); + lua_gettable(lua, 2); + if (lua_toboolean(lua, -1)) + attr.flags |= TB_PROCESS_FLAG_DETACH; + lua_pop(lua, 1); + // get outpath lua_pushstring(lua, "outpath"); lua_gettable(lua, 3); diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 9f1f7fb85..940f99696 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -588,9 +588,6 @@ end -- exit program function os.exit(...) - -- kill all pending processes first - process.killall() - -- do exit return os._exit(...) end diff --git a/xmake/core/base/process.lua b/xmake/core/base/process.lua index e2cad423f..78f698f6a 100644 --- a/xmake/core/base/process.lua +++ b/xmake/core/base/process.lua @@ -47,7 +47,6 @@ function _subprocess.new(program, proc) subprocess._PROGRAM = program subprocess._PROC = proc setmetatable(subprocess, _subprocess) - process._openlist()[subprocess:cdata()] = subprocess return subprocess end @@ -136,7 +135,6 @@ function _subprocess:close() -- close process ok = process._close(self:cdata()) if ok then - process._openlist()[self:cdata()] = nil self._PROC = nil end return ok @@ -162,16 +160,6 @@ function _subprocess:__gc() end end --- get all opened processes list -function process._openlist() - local list = process._LIST - if not list then - list = {} - process._LIST = list - end - return list -end - -- open a subprocess -- -- @param command the process command @@ -259,14 +247,5 @@ function process.openv(program, argv, opt) end end --- kill all pending process -function process.killall() - for _, proc in pairs(process._openlist()) do - if proc and proc:cdata() then - proc:kill() - end - end -end - -- return module: process return process diff --git a/xmake/core/main.lua b/xmake/core/main.lua index 8c2ceb664..b6a2b8503 100644 --- a/xmake/core/main.lua +++ b/xmake/core/main.lua @@ -263,14 +263,10 @@ Or you can add `--root` option or XMAKE_ROOT=y to allow run as root temporarily. end) ok, errors = scheduler:runloop() if not ok then - process.killall() utils.error(errors) return -1 end - -- kill all pending processes - process.killall() - -- dump deprecated entries deprecated.dump() diff --git a/xmake/core/sandbox/modules/import/core/base/process.lua b/xmake/core/sandbox/modules/import/core/base/process.lua index 2e773a1e9..b73e19fb5 100644 --- a/xmake/core/sandbox/modules/import/core/base/process.lua +++ b/xmake/core/sandbox/modules/import/core/base/process.lua @@ -121,10 +121,5 @@ function sandbox_core_base_process.openv(filename, argv, opt) return proc end --- kill all pending processes list -function sandbox_core_base_process.killall() - return process.killall() -end - -- return module return sandbox_core_base_process |
