Skip to content

Commit

Permalink
fix: do not fail fast if history file is unwritable (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno authored Jul 19, 2024
1 parent 85a3dda commit aba6824
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions brush-interactive/src/interactive_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ impl InteractiveShell {

let mut editor = Self::new_editor(options, shell)?;
if let Some(history_file_path) = &history_file_path {
// If the history file doesn't already exist, then make a best-effort attempt.
// to create it.
if !history_file_path.exists() {
std::fs::File::create(history_file_path)?;
let _ = std::fs::File::create(history_file_path);
}

editor.load_history(history_file_path)?;
// Make a best effort attempt to load the history file.
let _ = editor.load_history(history_file_path);
}

Ok(InteractiveShell {
Expand Down

0 comments on commit aba6824

Please sign in to comment.