Skip to content

Commit

Permalink
Print CLI errors to stderr instead of stdout
Browse files Browse the repository at this point in the history
This prevents them of sneaking into output files instead of being
displayed when manually generating bindings by redirecting stdout.
  • Loading branch information
sirhcel authored and emilio committed Jun 18, 2024
1 parent 9452ba1 commit cf9b02f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bindgen-cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn main() {
if verbose {
print_verbose_err()
}
println!("{}", info);
eprintln!("{}", info);
}));

let bindings =
Expand All @@ -49,21 +49,21 @@ pub fn main() {
bindings.write(output).expect("Unable to write output");
}
Err(error) => {
println!("{}", error);
eprintln!("{}", error);
std::process::exit(1);
}
};
}

fn print_verbose_err() {
println!("Bindgen unexpectedly panicked");
println!(
eprintln!("Bindgen unexpectedly panicked");
eprintln!(
"This may be caused by one of the known-unsupported \
things (https://rust-lang.github.io/rust-bindgen/cpp.html), \
please modify the bindgen flags to work around it as \
described in https://rust-lang.github.io/rust-bindgen/cpp.html"
);
println!(
eprintln!(
"Otherwise, please file an issue at \
https://github.com/rust-lang/rust-bindgen/issues/new"
);
Expand Down

0 comments on commit cf9b02f

Please sign in to comment.