Skip to content

Commit cf9b02f

Browse files
sirhcelemilio
authored andcommitted
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.
1 parent 9452ba1 commit cf9b02f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bindgen-cli/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn main() {
3838
if verbose {
3939
print_verbose_err()
4040
}
41-
println!("{}", info);
41+
eprintln!("{}", info);
4242
}));
4343

4444
let bindings =
@@ -49,21 +49,21 @@ pub fn main() {
4949
bindings.write(output).expect("Unable to write output");
5050
}
5151
Err(error) => {
52-
println!("{}", error);
52+
eprintln!("{}", error);
5353
std::process::exit(1);
5454
}
5555
};
5656
}
5757

5858
fn print_verbose_err() {
59-
println!("Bindgen unexpectedly panicked");
60-
println!(
59+
eprintln!("Bindgen unexpectedly panicked");
60+
eprintln!(
6161
"This may be caused by one of the known-unsupported \
6262
things (https://rust-lang.github.io/rust-bindgen/cpp.html), \
6363
please modify the bindgen flags to work around it as \
6464
described in https://rust-lang.github.io/rust-bindgen/cpp.html"
6565
);
66-
println!(
66+
eprintln!(
6767
"Otherwise, please file an issue at \
6868
https://github.com/rust-lang/rust-bindgen/issues/new"
6969
);

0 commit comments

Comments
 (0)