Skip to content

Watcher on macOS not emitting event #72

@ghivert

Description

@ghivert

Hi!

I'm trying to use fs with start_link on macOS (last version, 14.4.1, with Erlang/OTP 26), to watch my source files, and I don't know if I'm using it wrongly or if I encountered a bug. I have a minimal reproducible example here:

The structure of the project is:

fs_test
├─ rebar.config
└─ src
   ├─ module_2.erl
   └─ fs_test.erl

And in fs_test.erl, I have

-module(fs_test).

-export([main/1]).

main(_) ->
    fs:start_link(file_watcher, "src"),
    fs:start_looper(file_watcher),
    timer:sleep(infinity).

I'm launching the script from the root folder (fs_test here), and when I try to save or modify any file in src folder, nothing happen. However, when I change fs:start_link(file_watcher, "src") to fs:start_link(file_watcher, "."), it's working. I can live with the workaround right now, but I'd like to understand what's happening under the hood. 🙂

Am I missing something? Should I avoid relative links with fs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions