Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

wait

Waits for any child process to terminate.

Suspends the current process until any child process terminates. Returns the PID of the deceased child, or -1 if there are no child processes. Sets $? to the wait status of the child (encoding exit code and signal information).

Synopsis

my $pid = wait();
print "Child $pid exited with status $?\n";

See Also

waitpid, fork, $?