1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Fix crash when starting Alacritty on full drives

Since the Alacritty configuration file is written to the filesystem at
startup, this could create issues when the system does not have any free
space left.

To circumvent this problem, the default configuration is now returned
even when the configuration file could not be created. Instead of
crashing Alacritty, an error is now emitted.

Fixes #1936.
This commit is contained in:
Christian Duerr 2019-01-09 20:27:13 +00:00 committed by GitHub
parent c541155167
commit 8570ee004b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View file

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Replaced `Command` with `Super` in the Linux and Windows config documentation - Replaced `Command` with `Super` in the Linux and Windows config documentation
- Prevent semantic and line selection from starting with the right or middle mouse button - Prevent semantic and line selection from starting with the right or middle mouse button
- Prevent Alacritty from crashing when started on a system without any free space
## Version 0.2.5 ## Version 0.2.5

View file

@ -92,19 +92,21 @@ fn main() {
fn load_config(options: &cli::Options) -> Config { fn load_config(options: &cli::Options) -> Config {
let config_path = options.config_path() let config_path = options.config_path()
.or_else(Config::installed_config) .or_else(Config::installed_config)
.unwrap_or_else(|| { .or_else(|| Config::write_defaults().ok());
Config::write_defaults()
.unwrap_or_else(|err| die!("Write defaults config failure: {}", err))
});
if let Some(config_path) = config_path {
Config::load_from(&*config_path).unwrap_or_else(|err| { Config::load_from(&*config_path).unwrap_or_else(|err| {
match err { match err {
ConfigError::Empty => info!("Config file {:?} is empty; loading default", config_path), ConfigError::Empty => info!("Config file {:?} is empty; loading default", config_path),
_ => error!("Error: {}; loading default config", err), _ => error!("Unable to load default config: {}", err),
} }
Config::default() Config::default()
}) })
} else {
error!("Unable to write the default config");
Config::default()
}
} }
/// Run Alacritty /// Run Alacritty