From 2f552ac40835adf4b22c972dfa36a47f593e277b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 14 Jan 2019 00:35:00 +0100 Subject: [PATCH] Properly handle directory watcher creation failures. --- source/vibe/core/file.d | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/vibe/core/file.d b/source/vibe/core/file.d index 0ad3711..c3b6021 100644 --- a/source/vibe/core/file.d +++ b/source/vibe/core/file.d @@ -644,6 +644,8 @@ struct DirectoryWatcher { // TODO: avoid all those heap allocations! m_context = new Context; // FIME: avoid GC allocation (use FD user data slot) m_context.changeEvent = createManualEvent(); m_watcher = eventDriver.watchers.watchDirectory(path.toNativeString, recursive, &m_context.onChange); + if (m_watcher == WatcherID.invalid) + throw new Exception("Failed to watch directory."); m_context.path = path; m_context.recursive = recursive; m_context.changes = appender!(DirectoryChange[]);