Skip to content

Commit

Permalink
Prevent failure in case there is no config.toml file
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 25, 2020
1 parent 228a0ed commit 3156deb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,7 @@ impl Config {

let toml = file
.map(|file| {
let contents = t!(fs::read_to_string(&file));
match toml::from_str(&contents) {
fs::read_to_string(&file).ok().map(|contents| match toml::from_str(&contents) {
Ok(table) => table,
Err(err) => {
println!(
Expand All @@ -455,8 +454,9 @@ impl Config {
);
process::exit(2);
}
}
})
})
.flatten()
.unwrap_or_else(TomlConfig::default);

let build = toml.build.clone().unwrap_or_default();
Expand Down

0 comments on commit 3156deb

Please sign in to comment.