about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-27 13:44:20 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-29 08:01:16 -0700
commitc1149edf7a448a89d0f38f2802b3201885e52649 (patch)
treebe67a1214205b8b594bfd6717fecd9263b650b1f /src/rustllvm/RustWrapper.cpp
parent857ef6e272e5634cb9f3e6ee50eb6bc2a2e71651 (diff)
downloadrust-c1149edf7a448a89d0f38f2802b3201885e52649.tar.gz
rust-c1149edf7a448a89d0f38f2802b3201885e52649.zip
std: Fix inheriting standard handles on windows
Currently if a standard I/O handle is set to inherited on Windows, no action is
taken and the slot in the process information description is set to
`INVALID_HANDLE_VALUE`. Due to our passing of `STARTF_USESTDHANDLES`, however,
this means that the handle is actually set to nothing and if a child tries to
print it will generate an error.

This commit fixes this behavior by explicitly creating stdio handles to be
placed in these slots by duplicating the current process's I/O handles. This is
presumably what previously happened silently by using a file-descriptor-based
implementation instead of a `HANDLE`-centric implementation.

Along the way this cleans up a lot of code in `Process::spawn` for Windows by
ensuring destructors are always run, using more RAII, and limiting the scope of
`unsafe` wherever possible.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions