falood/file_system

Getting events from /private on macOS

Nicd opened this issue · 5 comments

Nicd commented

Hi!

I have this implementation of the monitor:

defmodule MebeWeb.FSMonitor do
  use ExFSWatch, dirs: [Path.expand("#{__DIR__}/../../../web/static")]

  require Logger

  def callback(:stop) do
    Logger.debug("Stopped file watcher.")
  end

  def callback(file_path, events) do
    Logger.debug(inspect({file_path, events}))
  end
end

When inspecting the path, I can see that the expanded path is /Users/nicd/svn/mebe/web/static. I get correct debug logs from files edited in that path, but I also get notifications from files in /private randomly. Example:

[debug] {"/Users/nicd/svn/mebe/web/static/js/app.js", [:inodemetamod, :modified]}
[debug] {"/private/var/folders/h9/b8n6qz715cj7ws460yq15v240000gn/T/etilqs_34edb43e617ebf2d", [:created, :removed, :xattrmod]}

Don't know if it's a problem in this project or in fs.

Elixir 1.4, Erlang 19.2, macOS 10.12.2.

I guess it's a bug of this project, I run the port command in the system tmp dir.
https://github.com/falood/exfswatch/blob/master/lib/exfswatch/worker.ex#L35-L36
Thank you for reporting this!
tracing...

Nicd commented

Guess related to this? 5HT/fs#29

It seems like the same problem, but I never start fs in exfswatch. maybe there's another place to config it.

my hacky dirty workaround

  def callback(<<"/private/",  _::binary>>, _) do
    # ignore default_fs paths being watched because of a bug
    # https://github.com/falood/exfswatch/issues/13
  end

It's a bug, I used wrong type for listener_extra_args and then pass wrong parameter to the port.