]> git.lizzy.rs Git - rust.git/commit
std: Don't spawn threads in `wait_with_output`
authorAlex Crichton <alex@alexcrichton.com>
Fri, 12 Feb 2016 18:29:25 +0000 (10:29 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 9 Mar 2016 18:12:36 +0000 (10:12 -0800)
commit7c3038f82477491e20c6f80c0139ddb1f1b912ca
tree915cb9e7c39365463e0c5ca2391e985dc72730b6
parent6afa32a2504fa90b48f74979bb4061cb397e9270
std: Don't spawn threads in `wait_with_output`

Semantically there's actually no reason for us to spawn threads as part of the
call to `wait_with_output`, and that's generally an incredibly heavyweight
operation for just reading a few bytes (especially when stderr probably rarely
has bytes!). An equivalent operation in terms of what's implemented today would
be to just drain both pipes of all contents and then call `wait` on the child
process itself.

On Unix we can implement this through some convenient use of the `select`
function, whereas on Windows we can make use of overlapped I/O. Note that on
Windows this requires us to use named pipes instead of anonymous pipes, but
they're semantically the same under the hood.
src/liblibc
src/libstd/process.rs
src/libstd/sys/unix/fd.rs
src/libstd/sys/unix/pipe.rs
src/libstd/sys/unix/process.rs
src/libstd/sys/windows/c.rs
src/libstd/sys/windows/handle.rs
src/libstd/sys/windows/net.rs
src/libstd/sys/windows/pipe.rs
src/libstd/sys/windows/stdio.rs