[det]wait(?Pid,
-Status)Wait for a child to change status. Then report the child that changed
status as well as the reason. If Pid is bound on entry then
the status of the specified child is reported. If not, then the status
of any child is reported. Status is unified with
exited(ExitCode)
if the child with pid Pid was
terminated by calling exit()
(Prolog halt/1).
ExitCode is the return status.
Status is unified with signaled(Signal)
if the
child died due to a software interrupt (see kill/2).
Signal contains the signal number. Finally, if the process suspended
execution due to a signal, Status is unified with stopped(Signal)
.