aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/config/monitor.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-06-17 01:33:47 +0300
committerGitHub <noreply@github.com>2022-06-16 22:33:47 +0000
commitff63344b7e396170cb7bb619bbed404268deaf90 (patch)
tree7f5e3f126f1bbc34ed144161a1d54b0ad37647b9 /alacritty/src/config/monitor.rs
parent4c171e767862e744ceed31def4036c79d7ebf1af (diff)
downloadalacritty-ff63344b7e396170cb7bb619bbed404268deaf90.tar.gz
alacritty-ff63344b7e396170cb7bb619bbed404268deaf90.zip
Ignore special files for live config reload
When using `--config-file /dev/null` with `live_config_reload`, each write to `/dev/null` was forcing alacritty to reload its configuration. This commit makes alacritty ignore special files for live config reload. Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty/src/config/monitor.rs')
-rw-r--r--alacritty/src/config/monitor.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/alacritty/src/config/monitor.rs b/alacritty/src/config/monitor.rs
index 63f7549f..305f5dfb 100644
--- a/alacritty/src/config/monitor.rs
+++ b/alacritty/src/config/monitor.rs
@@ -21,6 +21,13 @@ pub fn watch(mut paths: Vec<PathBuf>, event_proxy: EventLoopProxy<Event>) {
return;
}
+ // Exclude char devices like `/dev/null`, sockets, and so on, by checking that file type is a
+ // regular file.
+ paths.retain(|path| {
+ // Call `metadata` to resolve symbolink links.
+ path.metadata().map_or(false, |metadata| metadata.file_type().is_file())
+ });
+
// Canonicalize paths, keeping the base paths for symlinks.
for i in 0..paths.len() {
if let Ok(canonical_path) = paths[i].canonicalize() {