summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/luv/examples/killing-children.lua
blob: 6aab693d0c1973cec542fb409166d499ed5ae8d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local p = require('lib/utils').prettyPrint
local uv = require('luv')



local child, pid
child, pid = uv.spawn("sleep", {
  args = {"100"}
}, function (code, signal)
  p("EXIT", {code=code,signal=signal})
  uv.close(child)
end)

p{child=child, pid=pid}

-- uv.kill(pid, "SIGTERM")
uv.process_kill(child, "SIGTERM")

repeat
  print("\ntick.")
until uv.run('once') == 0

print("done")