mirror of
https://github.com/alacritty/alacritty.git
synced 2025-07-31 22:03:40 -04:00
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>
This commit is contained in:
parent
4c171e7678
commit
ff63344b7e
3 changed files with 11 additions and 1 deletions
|
@ -40,6 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Incorrect built-in glyphs for `U+2567` and `U+2568`
|
- Incorrect built-in glyphs for `U+2567` and `U+2568`
|
||||||
- Character mappings in the DEC special graphics character set (line drawing)
|
- Character mappings in the DEC special graphics character set (line drawing)
|
||||||
- Window flickering on resize on Wayland
|
- Window flickering on resize on Wayland
|
||||||
|
- Unnecessary config reload when using `/dev/null` as a config file
|
||||||
|
|
||||||
## 0.10.1
|
## 0.10.1
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::fmt::{self, Display, Formatter};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::{env, fs, io};
|
use std::{env, fs, io};
|
||||||
|
|
||||||
use log::{error, info};
|
use log::{debug, error, info};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_yaml::mapping::Mapping;
|
use serde_yaml::mapping::Mapping;
|
||||||
use serde_yaml::Value;
|
use serde_yaml::Value;
|
||||||
|
@ -125,6 +125,8 @@ pub fn load(options: &Options) -> UiConfig {
|
||||||
|
|
||||||
/// Attempt to reload the configuration file.
|
/// Attempt to reload the configuration file.
|
||||||
pub fn reload(config_path: &Path, options: &Options) -> Result<UiConfig> {
|
pub fn reload(config_path: &Path, options: &Options) -> Result<UiConfig> {
|
||||||
|
debug!("Reloading configuration file: {:?}", config_path);
|
||||||
|
|
||||||
// Load config, propagating errors.
|
// Load config, propagating errors.
|
||||||
let config_options = options.config_options.clone();
|
let config_options = options.config_options.clone();
|
||||||
let mut config = load_from(config_path, config_options)?;
|
let mut config = load_from(config_path, config_options)?;
|
||||||
|
|
|
@ -21,6 +21,13 @@ pub fn watch(mut paths: Vec<PathBuf>, event_proxy: EventLoopProxy<Event>) {
|
||||||
return;
|
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.
|
// Canonicalize paths, keeping the base paths for symlinks.
|
||||||
for i in 0..paths.len() {
|
for i in 0..paths.len() {
|
||||||
if let Ok(canonical_path) = paths[i].canonicalize() {
|
if let Ok(canonical_path) = paths[i].canonicalize() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue