1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::cmd::run_cmd_directly;
use crate::errors::ExecutionError;
use crate::parse::ExportErrorPageOpts;
use std::env;
use std::path::PathBuf;
pub fn export_error_page(dir: PathBuf, opts: ExportErrorPageOpts) -> Result<i32, ExecutionError> {
let target = dir.join(".perseus/builder");
run_cmd_directly(
format!(
"{} run --bin perseus-error-page-exporter {} {}",
env::var("PERSEUS_CARGO_PATH").unwrap_or_else(|_| "cargo".to_string()),
opts.code,
opts.output
),
&target,
)
}