From 7398d34ffd64813cb3f26c2545215745f3761736 Mon Sep 17 00:00:00 2001 From: Christian Meusel Date: Sun, 26 May 2024 15:38:41 +0200 Subject: [PATCH] Print CLI errors to stderr instead of stdout This prevents them of sneaking into output files instead of being displayed when manually generating bindings by redirecting stdout. --- bindgen-cli/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bindgen-cli/main.rs b/bindgen-cli/main.rs index a3a011fcc7..caa47c6268 100644 --- a/bindgen-cli/main.rs +++ b/bindgen-cli/main.rs @@ -38,7 +38,7 @@ pub fn main() { if verbose { print_verbose_err() } - println!("{}", info); + eprintln!("{}", info); })); let bindings = @@ -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" );