Module posix.sys.wait
Wait for Process Termination.
Functions
wait ([pid=-1[, options]]) | Wait for child process to terminate. |
Constants
posix.sys.wait | Wait constants. |
Functions
- wait ([pid=-1[, options]])
-
Wait for child process to terminate.
Parameters:
- pid int child process id to wait for, or -1 for any child process (default -1)
- options
int
bitwise OR of
WNOHANG
andWUNTRACED
(optional)
Returns:
-
int
pid of running child, if not exited yet and called with
WNOHANG
- string "running"
Or
- int pid of terminated child, if successful
- string "exited", "killed" or "stopped"
- int exit status, or signal number responsible for "killed" or "stopped"
Or
- nil
- string error message
- int errnum
See also:
Constants
- posix.sys.wait
-
Wait constants.
Any constants not available in the underlying system will be
nil
valued.Fields:
- WNOHANG int don't block waiting
- WUNTRACED int report status of stopped children
Usage:
-- Print wait constants supported on this host. for name, value in pairs (require "posix.sys.wait") do if type (value) == "number" then print (name, value) end end