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 WCONTINUED (only where XSI extensions are available) and WNOHANG, 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:

Constants

posix.sys.wait
Wait constants. Any constants not available in the underlying system will be nil valued.

Fields:

  • WNOHANG int do not hang if no status is available; return immediately.
  • WUNTRACED int report status of stopped child process
  • WCONTINUED int report status of continued child process, only available on hosts that support XSI extensions.

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.5.0 Last updated 2026-10-25 17:37:55