Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly flush stdio in the nailgun client. (pantsbuild#11383)
### Problem In some cases when `pantsd` is used, stdio is not flushed during successful runs (and failing runs as well, but successful is more unusual). See pantsbuild#11335. ### Solution Of the buffers listed in pantsbuild#11335 (comment), only the final step (writing to the `tokio::io::std*` handles) does not have a "guaranteed" flush when `Drop` runs, or when the channel is fully consumed. Usually the stdio file handles (`sys::io::std*`) would be torn down on `Drop` during a clean exit of a Rust process, and although their docs claim not to be buffered, their internal implementation is [line buffered by default](https://doc.rust-lang.org/src/std/io/stdio.rs.html#489). But Pants clients exit with `sys.exit`, and that likely bypasses `Drop` for statics. So: explicitly flush `tokio::io::std*` before exiting the client code. [ci skip-build-wheels]
- Loading branch information