Made sure the CmdRenderer always creates the destination dir

This commit is contained in:
Michael Bryan 2018-01-16 07:26:01 +08:00
parent b0e91193e9
commit be9a524eeb
No known key found for this signature in database
GPG key ID: E9C602B0D9A998DC

View file

@ -15,6 +15,7 @@ pub use self::html_handlebars::HtmlHandlebars;
mod html_handlebars; mod html_handlebars;
use std::fs;
use std::io::Read; use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
@ -152,6 +153,8 @@ impl Renderer for CmdRenderer {
fn render(&self, ctx: &RenderContext) -> Result<()> { fn render(&self, ctx: &RenderContext) -> Result<()> {
info!("Invoking the \"{}\" renderer", self.cmd); info!("Invoking the \"{}\" renderer", self.cmd);
let _ = fs::create_dir_all(&ctx.destination);
let mut child = self.compose_command()? let mut child = self.compose_command()?
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::inherit()) .stdout(Stdio::inherit())