Skip to content

Commit

Permalink
fix: avoids showing unnecessary configuration warnings (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoliveira authored Dec 16, 2024
1 parent 6b5a524 commit 5a20878
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fn main() {
}

pub fn execute_watch_command(watches: Watches, args: Args) {
let config_file_paths = if args.flag_config.is_empty() {
let possible_config_paths = if args.flag_config.is_empty() {
let dir = std::env::current_dir().expect("Failed to get current directory");
vec![
dir.join(cli::watch::DEFAULT_FILENAME)
Expand All @@ -241,6 +241,11 @@ pub fn execute_watch_command(watches: Watches, args: Args) {
vec![format!("{}", &args.flag_config)]
};

let config_file_paths = possible_config_paths
.into_iter()
.filter(|path| std::path::Path::new(path).exists())
.collect::<Vec<String>>();

// This here restarts the watcher if the config file changes
let watcher_pid = std::process::id();
let th = std::thread::spawn(move || {
Expand Down
2 changes: 2 additions & 0 deletions tests/watcher_reloads_config_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ fn it_terminates_the_current_running_watcher_when_config_changes() {
"The config file change was not triggered {}",
output
);

assert!(!output.contains("Funzzy warning: unknown file/directory"));
},
);
}

0 comments on commit 5a20878

Please sign in to comment.