use std::os::args;
use std::io;
-use std::io::process::Process;
+use std::io::process::{Process,ProcessConfig,InheritFd};
use serialize::json;
use serialize::Decodable;
use std::path::Path;
let mut decoder = json::Decoder::new(json);
let manifest: Manifest = Decodable::decode(&mut decoder);
- //let mut arguments = args();
- //arguments.shift();
-
- //if arguments[0] != ~"--" {
- //fail!("LOL");
- //} else {
- //arguments.shift();
- //}
-
let Manifest{ root, lib, .. } = manifest;
let root = Path::new(root);
let out_dir = lib[0].path;
let target = join(&root, ~"target");
- let args = ~[
+ let args = [
join(&root, out_dir),
~"--out-dir", target,
~"--crate-type", ~"lib"
Ok(val) => val
}
- println!("Executing {}", args);
+ println!("Executing {}", args.as_slice());
+
+ let mut config = ProcessConfig::new();
+ config.stdout = InheritFd(1);
+ config.stderr = InheritFd(2);
+ config.program = "rustc";
+ config.args = args.as_slice();
+
+ let mut p = Process::configure(config).unwrap();
- let mut p = Process::new("rustc", args).unwrap();
- let o = p.wait_with_output();
+ let status = p.wait();
- if o.status == std::io::process::ExitStatus(0) {
- println!("output: {:s}", std::str::from_utf8(o.output).unwrap());
- } else {
+ if status != std::io::process::ExitStatus(0) {
fail!("Failed to execute")
}
}