File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -417,7 +417,7 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
417417 let ( build_type, verbose) = cargo_build_args ( matches, & mut cargo) ;
418418 let quiet = matches. get_flag ( "quiet" ) ;
419419
420- cargo. arg ( "--message-format=json" ) ;
420+ cargo. arg ( "--message-format=json-diagnostic-rendered-ansi " ) ;
421421 cargo. stdout ( Stdio :: piped ( ) ) ;
422422
423423 if verbose > 0 {
@@ -431,9 +431,6 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
431431 let messages = Message :: parse_stream ( stdout) . collect :: < Vec < _ > > ( ) ;
432432
433433 let status = child. wait ( ) ?;
434- if !status. success ( ) {
435- bail ! ( "Failed to parse crate metadata" ) ;
436- }
437434
438435 let mut target_artifact: Option < Artifact > = None ;
439436 for message in messages {
@@ -460,6 +457,10 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
460457 }
461458 }
462459
460+ if !status. success ( ) {
461+ bail ! ( "Failed to parse crate metadata" ) ;
462+ }
463+
463464 if target_artifact. is_none ( ) {
464465 bail ! ( "Could not determine the wanted artifact" ) ;
465466 }
You can’t perform that action at this time.
0 commit comments