summaryrefslogtreecommitdiff
path: root/tests/test-forkexecwaitpid.lua
blob: 02abef0c3ad96f1793af1fd55c6b48e2d457117d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- See LICENSE file for copyright and license details.
local l = require "luxio"

local child = l.fork()

if child == 0 then
   l.exec("/bin/sleep", "/bin/sleep", "2")
else
   local pid, status = l.waitpid(child, l.WNOHANG)
   print("(WNOHANG)", pid, status)
   pid, status = l.waitpid(child, 0)
   print("WIFEXITED", l.WIFEXITED(status))
   print("WEXITSTATUS", l.WEXITSTATUS(status))
end