diff --git a/src/binary/command/prebuild.rs b/src/binary/command/prebuild.rs index 0848572..a03fec1 100644 --- a/src/binary/command/prebuild.rs +++ b/src/binary/command/prebuild.rs @@ -21,11 +21,16 @@ impl BinaryCommand for Command { for s in site.manifest.prebuild { let cmd_parts: Vec<&str> = s.split_whitespace().collect(); if !cmd_parts.is_empty() { - println!("runnning {}", s); - std::process::Command::new(cmd_parts[0]) + println!("runnning {} {}", cmd_parts[0], cmd_parts[1..].join(" ")); + let status = std::process::Command::new(cmd_parts[0]) .args(&cmd_parts[1..]) + .current_dir(build_dir) .spawn() - .unwrap_or_else(|_| panic!("command failed: {}", s)); + .unwrap_or_else(|_| panic!("spawn failed: {}", s)) + .wait()?; + if !status.success() { + return Ok(ExitStatus::Error); + } } } Ok(ExitStatus::Ok) diff --git a/src/manifest.rs b/src/manifest.rs index 1208791..d3c9bfe 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -115,9 +115,11 @@ impl Manifest { } "site_url" => manifest.site_url = value.as_str().map(|s| s.to_string()), "prebuild" => { - manifest.prebuild = value - .as_array() - .map_or(vec![], |v| v.iter().map(|s| s.to_string()).collect()) + manifest.prebuild = value.as_array().map_or(vec![], |v| { + v.iter() + .map(|s| s.as_str().map_or("".to_string(), |s| s.to_string())) + .collect() + }) } "pages" => manifest.pages_dir = path_or_err(value)?, "objects" => manifest.objects_dir = path_or_err(value)?,