facebook / facebook/watchman

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

Open
#1,002 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
13.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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.:

- start watchman
- start watch script
- create "foo.js" (notification)
- delete "foo.js" (notification)
- restart watch script
- get notified that "foo.js" was created

relevant code is almost straight from the docs:

```js
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);
});
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.