diff options
-rw-r--r-- | lem/signal/core.c | 9 | ||||
-rwxr-xr-x | test/signal.lua | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lem/signal/core.c b/lem/signal/core.c index 2f6f228..45be7fc 100644 --- a/lem/signal/core.c +++ b/lem/signal/core.c @@ -164,6 +164,8 @@ signal_child_handler(EV_P_ struct ev_child *w, int revents) { lua_State *S; int status; + int pid = w->pid; + int rpid = w->rpid; (void)revents; @@ -177,7 +179,12 @@ signal_child_handler(EV_P_ struct ev_child *w, int revents) lua_pushinteger(S, SIGCHLD); status = w->rstatus; - lua_createtable(S, 0, 3); + lua_createtable(S, 0, 5); + + lua_pushinteger(S, pid); + lua_setfield(S, -2, "pid"); + lua_pushinteger(S, rpid); + lua_setfield(S, -2, "rpid"); if (WIFEXITED(status)) { lua_pushinteger(S, WEXITSTATUS(status)); diff --git a/test/signal.lua b/test/signal.lua index 75e5429..38896a0 100755 --- a/test/signal.lua +++ b/test/signal.lua @@ -28,7 +28,7 @@ local sleeper = utils.newsleeper() assert(signal.register('sigchld', function(signum, ev) if ev.type == 'exited' then - print('child ' .. ev.type .. ' with status ' .. ev.status) + print('child ' .. ev.rpid .. ' ' .. ev.type .. ' with status ' .. ev.status) end end)) |