From 1987d846373b5062e524c58c7ac17e2f0d354d86 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 7 Mar 2026 16:02:32 -0600 Subject: [PATCH] fix: handle FileSystem :ignore in ProfileWatcher for CI --- lib/towerops/profiles/profile_watcher.ex | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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)")