Skip to content

Commit

Permalink
fix prebuild command
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseditson committed Mar 18, 2024
1 parent 14dafd5 commit 1156c97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/binary/command/prebuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
Expand Down

0 comments on commit 1156c97

Please sign in to comment.