- try
- printf "Received process event\n";flush Pervasives.stdout;
- let tr0,tr1 = Unix.pipe () in
- ignore(splice ifd tr1 4096);
- ignore(splice tr0 fifo_outfd 4096)
- with
- Failure(s)->fprintf logfd "Transfer failure: %s\n" s;flush logfd
+ try
+ printf "Received process event\n";flush Pervasives.stdout;
+ (* transferred = 4096 => there were at least 4096 bytes in the
+ * stream, so we should try again.
+ * transferred < 4096 => EAGAIN => either this is all the data we
+ * have (move on)
+ * OR XXX the receiver is blocking (supposedly this can't happen) *)
+ let transferred = ref 4096 in
+ while (!transferred == 4096) do
+ transferred:=tee ifd fifo_outfd 4096
+ done;
+ with
+ Failure(s)->logprint "Transfer failure: %s\n" s