diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index b17a41aa17d61c0dc8a8209f1e032aee242e254d..c41a1992540c9874ffbdcb27f543cbe0b6a5f240 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -454,11 +454,14 @@ function normalizePath(path: string): string { export function watch(path: string, onChange: (type: string, path: string) => void): fs.FSWatcher { const watcher = fs.watch(path); watcher.on('change', (type, raw) => { - let file = raw.toString(); - if (platform.isMacintosh) { - // Mac: uses NFD unicode form on disk, but we want NFC - // See also https://github.com/nodejs/node/issues/2165 - file = strings.normalizeNFC(file); + let file: string = null; + if (raw) { // https://github.com/Microsoft/vscode/issues/38191 + file = raw.toString(); + if (platform.isMacintosh) { + // Mac: uses NFD unicode form on disk, but we want NFC + // See also https://github.com/nodejs/node/issues/2165 + file = strings.normalizeNFC(file); + } } onChange(type, file);