diff --git a/lib/towerops/profiles/profile_watcher.ex b/lib/towerops/profiles/profile_watcher.ex index a0308c20..32b2a8a3 100644 --- a/lib/towerops/profiles/profile_watcher.ex +++ b/lib/towerops/profiles/profile_watcher.ex @@ -29,12 +29,17 @@ defmodule Towerops.Profiles.ProfileWatcher do profiles_path = Path.join(Application.app_dir(:towerops), @profiles_dir) # Start watching the profiles directory for changes (using apply to avoid compile-time warnings) - {:ok, watcher_pid} = apply(FileSystem, :start_link, [[dirs: [profiles_path]]]) - apply(FileSystem, :subscribe, [watcher_pid]) + case apply(FileSystem, :start_link, [[dirs: [profiles_path]]]) do + {:ok, watcher_pid} -> + apply(FileSystem, :subscribe, [watcher_pid]) + Logger.info("ProfileWatcher: Started watching #{profiles_path}") + {:ok, %{watcher_pid: watcher_pid, profiles_path: profiles_path}} - Logger.info("ProfileWatcher: Started watching #{profiles_path}") - - {:ok, %{watcher_pid: watcher_pid, profiles_path: profiles_path}} + :ignore -> + # inotify-tools not available (e.g., in CI) + Logger.debug("ProfileWatcher: FileSystem watcher not available, running in no-op mode") + {:ok, %{}} + end else # In production, FileSystem is not available Logger.debug("ProfileWatcher: FileSystem not available, running in no-op mode (dev-only feature)")