facebook / watchman

Watches files and records, or triggers actions, when they change.
https://facebook.github.io/watchman/
MIT License
12.57k stars 987 forks source link

Getting notifications for files that no longer exist when process is restarted #1002

Open ghost opened 2 years ago

ghost commented 2 years ago

I'm not sure if this is expected behavior or not, but it seems weird to me. I have a node process watching a folder, and when I restart that process (not the watchman process), I get a slew of events for files that no longer exist.

e.g.:

relevant code is almost straight from the docs:

  const client = new watchman.Client();

  client.command(['watch-project', folderToWatch], (cmdErr, cmdResp) => {
    const { watch } = cmdResp;

    client.command(
      ['subscribe', watch, subscriptionName, subscriptionConfig],
      (subErr) => {}
    );

    client.on('subscription', (resp) => {
      resp.files.forEach(processSubscriptionFile);
    });
  });
ghost commented 2 years ago

And jest sometimes refuses to see new tests until after I kill the watchman process.

Seem to just be horribly flaky in ubuntu 20.04 at least