Skip to content

Commit

Permalink
colorize output from cargo on non-Windows OSes
Browse files Browse the repository at this point in the history
related: rustwasm#298
  • Loading branch information
rhysd committed Jan 27, 2019
1 parent bedbf3d commit 7a94835
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ pub fn cargo_install_wasm_bindgen(
.context("failed to create temp dir for `cargo install wasm-bindgen`")?;

let mut cmd = Command::new("cargo");
if cfg!(not(windows)) {
cmd.arg("--color").arg("always");
}
cmd.arg("install")
.arg("--force")
.arg("wasm-bindgen-cli")
Expand Down
6 changes: 6 additions & 0 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ pub fn cargo_build_wasm(
let msg = format!("{}Compiling to WASM...", emoji::CYCLONE);
PBAR.step(step, &msg);
let mut cmd = Command::new("cargo");
if cfg!(not(windows)) {
cmd.arg("--color").arg("always");
}
cmd.current_dir(path).arg("build").arg("--lib");
match profile {
BuildProfile::Profiling => {
Expand Down Expand Up @@ -97,6 +100,9 @@ pub fn cargo_build_wasm(
/// Run `cargo build --tests` targetting `wasm32-unknown-unknown`.
pub fn cargo_build_wasm_tests(path: &Path, debug: bool) -> Result<(), Error> {
let mut cmd = Command::new("cargo");
if cfg!(not(windows)) {
cmd.arg("--color").arg("always");
}
cmd.current_dir(path).arg("build").arg("--tests");
if !debug {
cmd.arg("--release");
Expand Down

0 comments on commit 7a94835

Please sign in to comment.