haskell-fswatch / hfsnotify

Unified Haskell interface for basic file system notifications
BSD 3-Clause "New" or "Revised" License
136 stars 40 forks source link

Catch IO exceptions when initialising inotify on Linux #70

Closed ismail-s closed 7 years ago

ismail-s commented 7 years ago

@feuerbach See snoyberg/keter#167 for more info on the background behind this PR. I have tested this PR manually on the environment mentioned in that issue, where initInotify isn't available, and as expected hfsnotify switched to polling. I have only added exception catching for Linux as I am not running or testing on any other platforms, and wanted this PR to be as small as possible.

UnkindPartition commented 7 years ago

Looks good — could you fix the ambiguous occurrence of catch on ghc 7.4? Then I'll be happy to merge this.

ismail-s commented 7 years ago

Whoever wrote this blogpost would probably be annoyed with me, but I think 49952b0 should fix this.

UnkindPartition commented 7 years ago

Yeah, I'm not a fan of this solution either. A better approach is to say

import Control.Exception as E

and then use E.catch. Could you try that instead?

ismail-s commented 7 years ago

There you go.

UnkindPartition commented 7 years ago

Awesome, thanks! Released as 0.2.1.1