mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
watch: clarify that the fileName parameter can be null
Add a comment to clarify that the `fileName` parameter can be `null` if the file name cannot be determined. PR-URL: https://github.com/nodejs/node/pull/51305 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
@@ -97,8 +97,11 @@ class FilesWatcher extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
const watcher = watch(path, { recursive, signal: this.#signal });
|
||||
watcher.on('change', (eventType, fileName) => this
|
||||
.#onChange(recursive ? resolve(path, fileName ?? '') : path));
|
||||
watcher.on('change', (eventType, fileName) => {
|
||||
// `fileName` can be `null` if it cannot be determined. See
|
||||
// https://github.com/nodejs/node/pull/49891#issuecomment-1744673430.
|
||||
this.#onChange(recursive ? resolve(path, fileName ?? '') : path);
|
||||
});
|
||||
this.#watchers.set(path, { handle: watcher, recursive });
|
||||
if (recursive) {
|
||||
this.#removeWatchedChildren(path);
|
||||
|
||||
Reference in New Issue
Block a user