luaposix 35.1 Reference

# 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` and `WUNTRACED` (optional)

  ### Returns:

  1. int pid of running child, if not exited yet and called with `WNOHANG`
  2. string "running"

  ### Or

  1. int pid of terminated child, if successful
  2. string "exited", "killed" or "stopped"
  3. int exit status, or signal number responsible for "killed" or "stopped"

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### See also:

  - waitpid(2)
  - posix.unistd.fork

## 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

generated by LDoc 1.4.6 Last updated 2021-09-09 17:41:28