Allow config to be readonly (#1967)

This commit is contained in:
Jonathan Turner 2020-06-11 10:50:57 -07:00 committed by GitHub
parent 982f067d0e
commit a268e825aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,7 +65,11 @@ pub fn read(
Some(ref file) => file.clone(),
};
touch(&filename)?;
if !filename.exists() && touch(&filename).is_err() {
// If we can't create configs, let's just return an empty indexmap instead as we may be in
// a readonly environment
return Ok(IndexMap::new());
}
trace!("config file = {}", filename.display());