How about?
import FileWatching: watch_folder
function watch_folder(f, path::AbstractString)
while true
f(watch_folder(path))
end
end
I was able to run your original example with that function instead.
watch_task = @async watch_folder(".") ...