rust/src/libstd
bors 3f4227af13 Auto merge of #31409 - alexcrichton:command-exec, r=aturon
These commits are an implementation of https://github.com/rust-lang/rfcs/pull/1359 which is tracked via https://github.com/rust-lang/rust/issues/31398. The `before_exec` implementation fit easily with the current process spawning framework we have, but unfortunately the `exec` implementation required a bit of a larger refactoring. The stdio handles were all largely managed as implementation details of `std::process` and the `exec` function lived in `std::sys`, so the two didn't have access to one another.

I took this as a sign that a deeper refactoring was necessary, and I personally feel that the end result is cleaner for both Windows and Unix. The commits should be separated nicely for reviewing (or all at once if you're feeling ambitious), but the changes made here were:

* The process spawning on Unix was refactored in to a pre-exec and post-exec function. The post-exec function isn't allowed to do any allocations of any form, and management of transmitting errors back to the parent is managed by the pre-exec function (as it's the one that actually forks).
* Some management of the exit status was pushed into platform-specific modules. On Unix we must cache the return value of `wait` as the pid is consumed after we wait on it, but on Windows we can just keep querying the system because the handle stays valid.
* The `Stdio::None` variant was renamed to `Stdio::Null` to better reflect what it's doing.
* The global lock on `CreateProcess` is now correctly positioned to avoid unintended inheritance of pipe handles that other threads are sending to their child processes. After a more careful reading of the article referenced the race is not in `CreateProcess` itself, but rather the property that handles are unintentionally shared.
* All stdio management now happens in platform-specific modules. This provides a cleaner implementation/interpretation for `FromFraw{Fd,Handle}` for each platform as well as a cleaner transition from a configuration to what-to-do once we actually need to do the spawn.

With these refactorings in place, implementing `before_exec` and `exec` ended up both being pretty trivial! (each in their own commit)
2016-02-10 22:51:43 +00:00
..
collections Rollup merge of #31415 - tshepang:2-space-indent, r=steveklabnik 2016-02-04 16:39:06 -05:00
ffi Fix formatting in documentation of ffi::CString 2016-01-27 15:07:22 -08:00
io Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brson 2016-01-26 22:10:10 +00:00
net Revert deprecation of IpAddr, stabilizing for 1.7 2016-02-09 07:23:12 -08:00
num Some docs for std::num 2016-02-09 14:07:51 -05:00
os Add the asmjs-unknown-emscripten triple. Add cfgs to libs. 2016-02-06 20:56:14 +00:00
prelude mod.rs: fix typo 2016-02-09 11:47:42 -05:00
rand Remove "powerpc64le" and "mipsel" target_arch 2016-02-01 20:39:07 -08:00
sync std: _lock -> _guard in Mutex example 2016-02-08 14:48:12 +01:00
sys std: Move constant back to where it needs to be 2016-02-10 09:28:49 -08:00
thread Stop using unsafe code in TLS macro expansion (fixes #30756) 2016-02-04 22:23:20 +05:30
time std: Expose SystemTime accessors on fs::Metadata 2016-02-04 13:15:28 -08:00
ascii.rs Clarify scenario where AsciiExt appears to operate on non-ASCII 2016-02-04 11:34:11 -05:00
dynamic_lib.rs Add the asmjs-unknown-emscripten triple. Add cfgs to libs. 2016-02-06 20:56:14 +00:00
env.rs Add the asmjs-unknown-emscripten triple. Add cfgs to libs. 2016-02-06 20:56:14 +00:00
error.rs Impl Error for Box<T: Error> 2016-01-23 09:03:09 +01:00
fs.rs Minor spelling fixes 2016-02-09 11:52:39 -05:00
lib.rs Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brson 2016-01-26 22:10:10 +00:00
macros.rs Use different numbers of #s when expanding documentation comments 2016-01-19 06:24:08 +09:00
memchr.rs Minor spelling fixes 2016-02-09 11:52:39 -05:00
panic.rs Minor spelling fixes 2016-02-09 11:52:39 -05:00
panicking.rs Add message about RUST_BACKTRACE to default output of panic! 2016-01-26 10:37:12 +01:00
path.rs Improve docs for Path::methods 2016-02-03 01:16:58 +02:00
primitive_docs.rs make note of arity and 32-length restriction 2016-02-09 16:00:54 -05:00
process.rs std: Push process stdio setup in std::sys 2016-02-10 09:28:48 -08:00
rt.rs Fix warnings when compiling stdlib with --test 2015-12-29 16:07:01 +01:00
rtdeps.rs Rename sunos to solaris 2016-01-31 19:01:30 +03:00