mirror of
https://gitee.com/openharmony/third_party_rust_bindgen
synced 2025-03-04 12:47:22 +00:00
Drain the child processes stdout before waiting
For very large logs to stdout, this prevents deadlocks.
This commit is contained in:
parent
159fe962b2
commit
02da6536e2
12
src/lib.rs
12
src/lib.rs
@ -881,10 +881,6 @@ impl Builder {
|
||||
}
|
||||
|
||||
let mut child = cmd.spawn()?;
|
||||
if !child.wait()?.success() {
|
||||
return Err(io::Error::new(io::ErrorKind::Other,
|
||||
"clang exited with non-zero status"));
|
||||
}
|
||||
|
||||
let mut preprocessed = child.stdout.take().unwrap();
|
||||
let mut file = File::create(if is_cpp {
|
||||
@ -893,7 +889,13 @@ impl Builder {
|
||||
"__bindgen.i"
|
||||
})?;
|
||||
io::copy(&mut preprocessed, &mut file)?;
|
||||
Ok(())
|
||||
|
||||
if child.wait()?.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(io::Error::new(io::ErrorKind::Other,
|
||||
"clang exited with non-zero status"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user