4 use std::process::{self, Command};
7 let target = env::var("SCCACHE_TARGET").unwrap();
8 // Locate the actual compiler that we're invoking
9 env::set_var("CC", env::var_os("SCCACHE_CC").unwrap());
10 env::set_var("CXX", env::var_os("SCCACHE_CXX").unwrap());
11 let mut cfg = cc::Build::new();
12 cfg.cargo_metadata(false)
19 let compiler = cfg.get_compiler();
21 // Invoke sccache with said compiler
22 let sccache_path = env::var_os("SCCACHE_PATH").unwrap();
23 let mut cmd = Command::new(&sccache_path);
24 cmd.arg(compiler.path());
25 for &(ref k, ref v) in compiler.env() {
28 for arg in env::args().skip(1) {
32 if let Ok(s) = env::var("SCCACHE_EXTRA_ARGS") {
33 for s in s.split_whitespace() {
38 let status = cmd.status().expect("failed to spawn");
39 process::exit(status.code().unwrap_or(2))