vicuna_runtime/lib.rs
1use anyhow::Result;
2use std::path::Path;
3use std::process::Command;
4use which::which;
5
6pub fn execute_file(file_path: &Path) -> Result<()> {
7 println!("=================");
8 let exit_status = Command::new(which("node")?)
9 .arg(file_path)
10 .spawn()?
11 .wait()?;
12 println!("=================");
13 if exit_status.success() {
14 Ok(())
15 } else {
16 Err(anyhow::anyhow!("execution failed"))
17 }
18}