Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
let (build_type, verbose) = cargo_build_args(matches, &mut cargo);
let quiet = matches.get_flag("quiet");

cargo.arg("--message-format=json");
cargo.arg("--message-format=json-diagnostic-rendered-ansi");
cargo.stdout(Stdio::piped());

if verbose > 0 {
Expand All @@ -428,9 +428,6 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
let messages = Message::parse_stream(stdout).collect::<Vec<_>>();

let status = child.wait()?;
if !status.success() {
bail!("Failed to parse crate metadata");
}

let mut target_artifact: Option<Artifact> = None;
for message in messages {
Expand All @@ -457,6 +454,10 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
}
}

if !status.success() {
bail!("Failed to parse crate metadata");
}

if target_artifact.is_none() {
bail!("Could not determine the wanted artifact");
}
Expand Down