diff --git a/src/main.rs b/src/main.rs index e538d01..cdb9fd2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,22 +62,17 @@ fn exec( output: Option, verbosity: u64, ) -> Result<(), Problem> { + // Our first elm make call is where we build the users program. There is a pretty good chance + // this won't work. let mut command = Command::new("elm"); command .arg("make") .arg("--output") - .arg("/dev/null") - .stdin(Stdio::null()); - - if verbosity < 1 { - command.stderr(Stdio::null()); - command.stdout(Stdio::null()); - } else { - let pipe = dup_stderr() - .map_err(|io_err| CompilerError::ReadInputFailed(io_err, "stdout".into()))?; - command.stdout(pipe); - command.stderr(Stdio::piped()); - } + .arg("/dev/null"); + //.stdin(Stdio::null()); + //.stdout(Stdio::null()); + // I am using the default inherit stderr behavior here. + //.stderr(Stdio::piped()); if debug { command.arg("--debug"); @@ -85,14 +80,18 @@ fn exec( command.arg(&file); let start = Instant::now(); - match command.status() { - Ok(exit_status) => { - if !exit_status.success() { - // TODO report the stdout from the elm compiler - return Err(Problem::Wildcard("elm failed".into())); + match command.output() { + Ok(output) => { + if !output.status.success() { + io::stderr().write_all(&output.stderr).unwrap(); + return Err(CompilerError::FailedBuildingFixture.into()); + } + if verbosity > 0 { + io::stderr().write_all(&output.stderr).unwrap(); } } - Err(_) => { + Err(io_err) => { + // TODO handle this one return Err(Problem::Wildcard("elm failed".into())); } } @@ -699,7 +698,7 @@ fn setup_generator_project(verbosity: u64, elm_project_dir: PathBuf) -> Result