Skip to content

Commit

Permalink
Always consider empty output to be unsuccessful
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 19, 2023
1 parent d3da419 commit 6c0e838
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions precompiled/serde_derive/src/lib_precompiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::bytecode::Bytecode;
use proc_macro::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
use std::io::{Read, Write};
use std::iter::FromIterator;
use std::process::{Command, Stdio};
use std::process::{Command, ExitStatus, Stdio};
use std::str::FromStr;

#[proc_macro_derive(Serialize, attributes(serde))]
Expand Down Expand Up @@ -48,11 +48,8 @@ fn derive(select: u8, input: TokenStream) -> TokenStream {
buf.clear();
stdout.read_to_end(&mut buf).unwrap();

let success = match child.wait() {
Ok(exit_status) => exit_status.success(),
Err(_) => !buf.is_empty(),
};
if !success {
let success = child.wait().as_ref().map_or(true, ExitStatus::success);
if !success || buf.is_empty() {
panic!();
}

Expand Down

0 comments on commit 6c0e838

Please sign in to comment.