Rollup merge of #48558 - Mark-Simulacrum:error-format, r=Manishearth

Fix error-format to properly send JSON to stdout

Since we take Cargo's JSON messages as well we need to specifically send
rustc's messages out so we don't hide them.

r? @Manishearth
This commit is contained in:
kennytm 2018-02-28 19:15:41 +08:00 committed by GitHub
commit 4b4cd47021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -1007,6 +1007,10 @@ pub fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path, is_check: boo
continue
};
if json["reason"].as_str() != Some("compiler-artifact") {
if build.config.rustc_error_format.as_ref().map_or(false, |e| e == "json") {
// most likely not a cargo message, so let's send it out as well
println!("{}", line);
}
continue
}
for filename in json["filenames"].as_array().unwrap() {

View File

@ -119,7 +119,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
opts.optflag("h", "help", "print this help message");
opts.optflag("", "error-format", "rustc error format");
opts.optopt("", "error-format", "rustc error format", "FORMAT");
// fn usage()
let usage = |exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {