let receive_process_event (idesc: fname_and_fd) (_: fname_and_fd) =
let (_,ifd) = idesc in
let cp = try Hashtbl.find open_fds ifd with
Not_found->
fprintf logfd "Fifo fd disappeared\n";flush logfd;raise Bug
in
match (cp) with
| Fifo(fifo_outfd) ->
begin
try
printf "Received process event\n";flush Pervasives.stdout;
let transferred = ref 4096 in
while (!transferred == 4096) do
transferred:=tee ifd fifo_outfd 4096
done;
with
Failure(s)->fprintf logfd "Transfer failure: %s\n" s;flush logfd
end
| _ -> fprintf logfd "Bug! Process fd received in the channel handler\n";flush logfd;raise Bug