use status() instead of output() to capture the output of the lessc/browserify process, panic if it fails
This commit is contained in:
parent
ae8630e038
commit
11bdb6c878
18
src/lib.rs
18
src/lib.rs
@ -16,10 +16,15 @@ pub fn browserify (infile: &str, outfile: &str) -> PathBuf {
|
|||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let out_dir = Path::new(&out_dir);
|
let out_dir = Path::new(&out_dir);
|
||||||
let full_outfile = out_dir.join(outfile);
|
let full_outfile = out_dir.join(outfile);
|
||||||
Command::new("node_modules/.bin/browserify")
|
let status = Command::new("node_modules/.bin/browserify")
|
||||||
.args(&[infile, "-o", full_outfile.to_str().expect("failed to build output path")])
|
.args(&[infile, "-o", full_outfile.to_str().expect("failed to build output path")])
|
||||||
.output()
|
.status()
|
||||||
.expect("failed to build js bundle");
|
.expect("failed to build js bundle");
|
||||||
|
|
||||||
|
if !status.success() {
|
||||||
|
panic!("Failed to browserify input file {}", infile);
|
||||||
|
}
|
||||||
|
|
||||||
full_outfile
|
full_outfile
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,10 +32,15 @@ pub fn lessc (infile: &str, outfile: &str) -> PathBuf {
|
|||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let out_dir = Path::new(&out_dir);
|
let out_dir = Path::new(&out_dir);
|
||||||
let full_outfile = out_dir.join(outfile);
|
let full_outfile = out_dir.join(outfile);
|
||||||
Command::new("node_modules/.bin/lessc")
|
let status = Command::new("node_modules/.bin/lessc")
|
||||||
.args(&[infile, full_outfile.to_str().expect("failed to build output path")])
|
.args(&[infile, full_outfile.to_str().expect("failed to build output path")])
|
||||||
.output()
|
.status()
|
||||||
.expect("failed to build css bundle");
|
.expect("failed to build css bundle");
|
||||||
|
|
||||||
|
if !status.success() {
|
||||||
|
panic!("Failed to lessc input file {}", infile);
|
||||||
|
}
|
||||||
|
|
||||||
full_outfile
|
full_outfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user