diff --git a/lsyncd.c b/lsyncd.c index de03b97..18cbba7 100644 --- a/lsyncd.c +++ b/lsyncd.c @@ -907,6 +907,20 @@ masterloop(lua_State *L) handle_event(L, NULL); } + /* collect zombified child processes */ + while(1) { + pid_t pid = waitpid(0, &status, WNOHANG); + int status; + + if (pid <= 0) { + break; + } + lua_getglobal(L, "lsyncd_collect_child"); + lua_pushinteger(L, pid); + lua_pushinteger(L, WEXITSTATUS(status)); + lua_call(L, 2, 0); + } + /* let the runner spawn child processes */ lua_getglobal(L, "lsyncd_alarm"); lua_pushinteger(L, times(NULL)); diff --git a/lsyncd.lua b/lsyncd.lua index 37e9d25..1a5b452 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -54,6 +54,7 @@ local origins = {} -- .filename .. filename or nil (=dir itself) -- (.movepeer) .. for MOVEFROM/MOVETO link to other delay -- } +- -- } -- local targets = {}