File: test-forkexecpwaitpid.lua

package info (click to toggle)
luxio 13-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 420 kB
  • ctags: 449
  • sloc: ansic: 3,117; makefile: 72; sh: 24
file content (13 lines) | stat: -rw-r--r-- 663 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
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