Merge pull request #473 from androbtech/history

Avoid panicking if history can't be saved.
This commit is contained in:
Andrés N. Robalino 2019-08-26 18:47:07 -05:00 committed by GitHub
commit e32291d0d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -217,6 +217,7 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
let _ = ansi_term::enable_ansi_support();
}
// we are ok if history does not exist
let _ = rl.load_history("history.txt");
let ctrl_c = Arc::new(AtomicBool::new(false));
@ -297,7 +298,9 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
}
ctrlcbreak = false;
}
rl.save_history("history.txt")?;
// we are ok if we can not save history
let _ = rl.save_history("history.txt");
Ok(())
}