Skip to content

Commit

Permalink
fix ci, change result to expect
Browse files Browse the repository at this point in the history
  • Loading branch information
oleflb committed Jan 23, 2024
1 parent a838a40 commit 46e7cd8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/code_generation/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,13 @@ fn generate_recording_thread(cyclers: &Cyclers) -> TokenStream {
let instance_name_snake_case = format_ident!("{}", instance.to_case(Case::Snake));
let recording_file_name = format!("{instance}.{{seconds}}.bincode");
let error_message_file = format!("failed to create recording file for {instance}");
let error_message_folder = format!("failed to create logs folder");

quote! {
let recording_file_path = std::path::Path::new("logs").join(format!(#recording_file_name));
std::fs::create_dir_all(
recording_file_path.parent()
.ok_or(color_eyre::Report::msg(format!("{} does not have a parent directory", recording_file_path.display())))?
).wrap_err(#error_message_folder)?;
.expect("recording file path has no parent directory")
).wrap_err("failed to create logs folder")?;

let mut #instance_name_snake_case = std::io::BufWriter::new(std::fs::File::create(recording_file_path).wrap_err(#error_message_file)?); // TODO: possible optimization: buffer size
}
Expand Down

0 comments on commit 46e7cd8

Please sign in to comment.