Skip to content

Commit

Permalink
Adding in a more verbose failure for autogen
Browse files Browse the repository at this point in the history
  • Loading branch information
nwdepatie committed Feb 27, 2024
1 parent bc01f7f commit 4c51795
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ use std::process::Command;
fn main() {
println!("cargo:rerun-if-env-changed=ALWAYS_RUN");

// Create a new command that runs bash
let mut command = Command::new("python3");

// Pass the script name as an argument
command.arg("./calypsogen.py");

// Execute the command
// This will download a file called ncbi_dataset.zip in the current directory
command.output().expect("Failed to generate can messages!");
match Command::new("python3").arg("./calypsogen.py").status() {
Ok(status) if status.success() => {
println!("Python script executed successfully");
},
Ok(status) => {
eprintln!("Python script exited with status: {}", status);
std::process::exit(1);
},
Err(e) => {
eprintln!("Failed to execute Python script: {}", e);
std::process::exit(1);
},
}
}

0 comments on commit 4c51795

Please sign in to comment.