From 63bf8a66dfd43a5f94a2035e6ee98a8cd064e1d1 Mon Sep 17 00:00:00 2001 From: vnc5 Date: Thu, 28 Dec 2023 21:44:44 +0100 Subject: [PATCH] watch: fix null `fileName` on windows systems PR-URL: https://github.com/nodejs/node/pull/49891 Reviewed-By: Moshe Atlow Reviewed-By: Chemi Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca --- lib/internal/watch_mode/files_watcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/watch_mode/files_watcher.js b/lib/internal/watch_mode/files_watcher.js index 895c6ec138d131..51b09c840b65f4 100644 --- a/lib/internal/watch_mode/files_watcher.js +++ b/lib/internal/watch_mode/files_watcher.js @@ -98,7 +98,7 @@ class FilesWatcher extends EventEmitter { } const watcher = watch(path, { recursive, signal: this.#signal }); watcher.on('change', (eventType, fileName) => this - .#onChange(recursive ? resolve(path, fileName) : path)); + .#onChange(recursive ? resolve(path, fileName ?? '') : path)); this.#watchers.set(path, { handle: watcher, recursive }); if (recursive) { this.#removeWatchedChildren(path);