let pid,status = Unix.wait () in
(match status with
| Unix.WEXITED 0 -> ()
- | _ -> prerr_endline (Printf.sprintf "PEON %d HAD A PROBLEM" pid));
+ | Unix.WEXITED s ->
+ prerr_endline (Printf.sprintf "PEON %d EXIT STATUS %d" pid s)
+ | Unix.WSIGNALED s ->
+ prerr_endline
+ (Printf.sprintf "PEON %d HAD A PROBLEM, KILLED BY SIGNAL %d" pid s)
+ | Unix.WSTOPPED s ->
+ prerr_endline
+ (Printf.sprintf "PEON %d HAD A PROBLEM, STOPPED BY %d" pid s));
let p = fst(List.find (fun (_,x) -> x = pid) !peons) in
peons := List.filter (fun (x,_) -> x <> p) !peons;
peons := (p,0) :: !peons