summaryrefslogtreecommitdiff
path: root/tests/test-forkexecpwaitpid.lua
blob: 98e2e0cf94a610b46203f6b3e67a671e9666af55 (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.execp("sleep", "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