Skip to content

Commit

Permalink
fix: make history file creation error non fatal (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno authored Aug 21, 2024
1 parent 2497377 commit 9cc767f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions brush-interactive/src/interactive_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,20 @@ impl InteractiveShell {
}

if let Some(history_file_path) = &self.history_file_path {
// TODO: Decide append or not based on configuration.
self.editor.append_history(history_file_path)?;
let history_result = if self.shell().options.append_to_history_file {
self.editor.append_history(history_file_path)
} else {
self.editor.save_history(history_file_path)
};

if let Err(e) = history_result {
// N.B. This seems like the sort of thing that's worth being noisy about,
// but bash doesn't do that -- and probably for a reason.
tracing::debug!(
"couldn't save history to {}: {e}",
history_file_path.display()
);
}
}

Ok(())
Expand Down

0 comments on commit 9cc767f

Please sign in to comment.