Skip to content

Commit

Permalink
rust: single compile error message
Browse files Browse the repository at this point in the history
  • Loading branch information
randommm committed Mar 5, 2024
1 parent 2a8db36 commit 86e9ee8
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions rust/src/download_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,25 @@ where
} else {
"make"
};
let proc = std::process::Command::new(make)
std::process::Command::new(make)
.args(cmd)
.current_dir(bs_path)
.env("STAN_THREADS", "true")
.output()
.map_err(|e| e.to_string())
.and_then(|proc| {
if !proc.status.success() {
Err(format!(
"{} {}",
String::from_utf8_lossy(proc.stdout.as_slice()).into_owned(),
String::from_utf8_lossy(proc.stderr.as_slice()).into_owned(),
))
} else {
Ok(())
}
})
.map_err(|e| BridgeStanError::ModelCompilingFailed(e.to_string()))?;
info!("Finished compiling model");

if !proc.status.success() {
return Err(BridgeStanError::ModelCompilingFailed(format!(
"{} {}",
String::from_utf8_lossy(proc.stdout.as_slice()).into_owned(),
String::from_utf8_lossy(proc.stderr.as_slice()).into_owned(),
)));
}
Ok(output)
}

0 comments on commit 86e9ee8

Please sign in to comment.