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