diff --git a/ofborg/src/evalchecker.rs b/ofborg/src/evalchecker.rs index ec73fa6..8abf26b 100644 --- a/ofborg/src/evalchecker.rs +++ b/ofborg/src/evalchecker.rs @@ -28,7 +28,7 @@ impl EvalChecker { } pub fn execute(&self, path: &Path) -> Result { - self.nix.safely(&self.cmd, path, self.args.clone()) + self.nix.safely(&self.cmd, path, self.args.clone(), false) } pub fn cli_cmd(&self) -> String { diff --git a/ofborg/src/nix.rs b/ofborg/src/nix.rs index 88b9469..a3244eb 100644 --- a/ofborg/src/nix.rs +++ b/ofborg/src/nix.rs @@ -40,18 +40,27 @@ impl Nix { attrargs.push(attr); } - return self.safely("nix-build", nixpkgs, attrargs); + return self.safely("nix-build", nixpkgs, attrargs, true); } - pub fn safely(&self, cmd: &str, nixpkgs: &Path, args: Vec) -> Result { + pub fn safely(&self, cmd: &str, nixpkgs: &Path, args: Vec, keep_stdout: bool) -> Result { let mut nixpath = OsString::new(); nixpath.push("nixpkgs="); nixpath.push(nixpkgs.as_os_str()); - let stdout = tempfile().expect("Fetching a stdout tempfile"); - let stderr = stdout.try_clone().expect("Cloning stdout for stderr"); + let stderr = tempfile().expect("Fetching a stderr tempfile"); let mut reader = stderr.try_clone().expect("Cloning stderr to the reader"); + let stdout: Stdio; + + if keep_stdout { + let stdout_fd = stderr.try_clone().expect("Cloning stderr for stdout"); + stdout = Stdio::from(stdout_fd); + } else { + stdout = Stdio::null(); + } + + let status = Command::new(cmd) .env_clear() .current_dir(nixpkgs) diff --git a/ofborg/src/tasks/massrebuilder.rs b/ofborg/src/tasks/massrebuilder.rs index 65d720d..d61a248 100644 --- a/ofborg/src/tasks/massrebuilder.rs +++ b/ofborg/src/tasks/massrebuilder.rs @@ -436,7 +436,8 @@ impl Stdenvs { String::from("."), String::from("-A"), String::from("stdenv"), - ] + ], + false ); println!("{:?}", result);