summaryrefslogtreecommitdiffstats
path: root/vendor/fwdansi/examples/run-rustc.rs
blob: 79516014ea9def1e7cbfa50a3e8f0f5a471b2623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate fwdansi;
extern crate termcolor;

use fwdansi::write_ansi;
use std::io;
use std::process::Command;
use termcolor::*;

fn main() -> io::Result<()> {
    let output = Command::new("rustc").args(&["--color", "always"]).output()?;

    let mut stderr = StandardStream::stderr(ColorChoice::Always);
    write_ansi(&mut stderr, &output.stderr)?;
    //^ should print "error: no input filename given" with appropriate color everywhere.

    Ok(())
}