mirage / irmin-watcher

Portable implementation of the Irmin Watch API
ISC License
14 stars 15 forks source link

Inotify can raise some errors if init is too fast #10

Open samoht opened 7 years ago

samoht commented 7 years ago

See https://github.com/dsheets/ocaml-inotify-event/blob/master/src/inotify_events.ml#L38

The fix is too run:

    (* Block until there is something to read. Otherwise, our ioctl
       returns 0 and then makes a 0 read which errors with EINVAL. *)
    ignore (Unix.select [inotify] [] [] ~-.1.);

before calling Inotify.read

samoht commented 7 years ago

/cc @dsheets (who wrote that bit of code) and @whitequark (who maintain the upstream inotify bindings)

dsheets commented 7 years ago

I think you mean @whitequark...