mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
Fix reloading with empty config
When loading an empty configuration file, Alacritty only prints an info message and then proceeds to load the default config. However when reloading the configuration file it would throw a hard error. This has been fixed and a hard error is now only thrown when an error is returned during reload which isn't the empty file error.
This commit is contained in:
parent
863d5581a6
commit
53e491709d
2 changed files with 25 additions and 11 deletions
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Resolved off-by-one issue with erasing characters in the last column
|
- Resolved off-by-one issue with erasing characters in the last column
|
||||||
- Excessive polling every 100ms with `live_config_reload` enabled
|
- Excessive polling every 100ms with `live_config_reload` enabled
|
||||||
- Unicode characters at the beginning of URLs are now properly ignored
|
- Unicode characters at the beginning of URLs are now properly ignored
|
||||||
|
- Remove error message when reloading an empty config
|
||||||
|
|
||||||
## Version 0.2.7
|
## Version 0.2.7
|
||||||
|
|
||||||
|
|
|
@ -2224,18 +2224,31 @@ impl Monitor {
|
||||||
loop {
|
loop {
|
||||||
match rx.recv().expect("watcher event") {
|
match rx.recv().expect("watcher event") {
|
||||||
DebouncedEvent::Rename(_, _) => continue,
|
DebouncedEvent::Rename(_, _) => continue,
|
||||||
DebouncedEvent::Write(path) | DebouncedEvent::Create(path)
|
DebouncedEvent::Write(path)
|
||||||
| DebouncedEvent::Chmod(path) => {
|
| DebouncedEvent::Create(path)
|
||||||
// Reload file
|
| DebouncedEvent::Chmod(path) =>
|
||||||
if path == config_path {
|
{
|
||||||
match Config::load_from(path) {
|
if path != config_path {
|
||||||
Ok(config) => {
|
continue;
|
||||||
let _ = config_tx.send(config);
|
}
|
||||||
handler.on_config_reload();
|
|
||||||
},
|
let config = match Config::load_from(&path) {
|
||||||
Err(err) => error!("Ignoring invalid config: {}", err),
|
Ok(config) => {
|
||||||
|
config
|
||||||
|
},
|
||||||
|
Err(err) => {
|
||||||
|
if let Error::Empty = err {
|
||||||
|
info!("Config file {:?} is empty; loading default", path);
|
||||||
|
Config::default()
|
||||||
|
} else {
|
||||||
|
error!("Ignoring invalid config: {}", err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
let _ = config_tx.send(config);
|
||||||
|
handler.on_config_reload();
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue