Rename the "default inheritance" concept to "duplicate".
This commit is contained in:
parent
0b2e0c20ee
commit
ff5be78af6
@ -9,8 +9,8 @@
|
|||||||
// There are variations between OS releases, especially with regards to
|
// There are variations between OS releases, especially with regards to
|
||||||
// how console handles work.
|
// how console handles work.
|
||||||
|
|
||||||
REGISTER(Test_CreateProcess_DefaultInherit, always);
|
REGISTER(Test_CreateProcess_Duplicate, always);
|
||||||
static void Test_CreateProcess_DefaultInherit() {
|
static void Test_CreateProcess_Duplicate() {
|
||||||
{
|
{
|
||||||
// Base case: a non-inheritable pipe is still inherited.
|
// Base case: a non-inheritable pipe is still inherited.
|
||||||
Worker p;
|
Worker p;
|
||||||
@ -85,9 +85,8 @@ static void Test_CreateProcess_DefaultInherit() {
|
|||||||
{
|
{
|
||||||
// Test setting STDIN/STDOUT/STDERR to non-inheritable console handles.
|
// Test setting STDIN/STDOUT/STDERR to non-inheritable console handles.
|
||||||
//
|
//
|
||||||
// On old releases, default inheritance's handle duplication does not
|
// Handle duplication does not apply to traditional console handles,
|
||||||
// apply to console handles, and a console handle is inherited if and
|
// and a console handle is inherited if and only if it is inheritable.
|
||||||
// only if it is inheritable.
|
|
||||||
//
|
//
|
||||||
// On new releases, this will Just Work.
|
// On new releases, this will Just Work.
|
||||||
//
|
//
|
@ -6,8 +6,8 @@
|
|||||||
// Naturally, this was unintended behavior, and as of Windows 8.1, the handle
|
// Naturally, this was unintended behavior, and as of Windows 8.1, the handle
|
||||||
// is instead translated to NULL.
|
// is instead translated to NULL.
|
||||||
|
|
||||||
REGISTER(Test_CreateProcess_DefaultInherit_PseudoHandleBug, always);
|
REGISTER(Test_CreateProcess_Duplicate_PseudoHandleBug, always);
|
||||||
static void Test_CreateProcess_DefaultInherit_PseudoHandleBug() {
|
static void Test_CreateProcess_Duplicate_PseudoHandleBug() {
|
||||||
Worker p;
|
Worker p;
|
||||||
Handle::invent(GetCurrentProcess(), p).setStdout();
|
Handle::invent(GetCurrentProcess(), p).setStdout();
|
||||||
auto c = p.child({ false });
|
auto c = p.child({ false });
|
@ -3,8 +3,8 @@
|
|||||||
// Windows XP bug: default inheritance doesn't work with the read end
|
// Windows XP bug: default inheritance doesn't work with the read end
|
||||||
// of a pipe, even if it's inheritable. It works with the write end.
|
// of a pipe, even if it's inheritable. It works with the write end.
|
||||||
|
|
||||||
REGISTER(Test_CreateProcess_DefaultInherit_XPPipeBug, always);
|
REGISTER(Test_CreateProcess_Duplicate_XPPipeBug, always);
|
||||||
static void Test_CreateProcess_DefaultInherit_XPPipeBug() {
|
static void Test_CreateProcess_Duplicate_XPPipeBug() {
|
||||||
auto check = [](Worker &proc, Handle correct, bool expectBroken) {
|
auto check = [](Worker &proc, Handle correct, bool expectBroken) {
|
||||||
CHECK((proc.getStdin().value() == nullptr) == expectBroken);
|
CHECK((proc.getStdin().value() == nullptr) == expectBroken);
|
||||||
CHECK((proc.getStdout().value() == nullptr) == expectBroken);
|
CHECK((proc.getStdout().value() == nullptr) == expectBroken);
|
@ -42,10 +42,10 @@ TEST_OBJECTS = \
|
|||||||
|
|
||||||
HANDLETESTS_OBJECTS = \
|
HANDLETESTS_OBJECTS = \
|
||||||
build/obj/HandleTests/CreateProcess.o \
|
build/obj/HandleTests/CreateProcess.o \
|
||||||
build/obj/HandleTests/CreateProcess_DefaultInherit.o \
|
|
||||||
build/obj/HandleTests/CreateProcess_DefaultInherit_PseudoHandleBug.o \
|
|
||||||
build/obj/HandleTests/CreateProcess_DefaultInherit_XPPipeBug.o \
|
|
||||||
build/obj/HandleTests/CreateProcess_Detached.o \
|
build/obj/HandleTests/CreateProcess_Detached.o \
|
||||||
|
build/obj/HandleTests/CreateProcess_Duplicate.o \
|
||||||
|
build/obj/HandleTests/CreateProcess_Duplicate_PseudoHandleBug.o \
|
||||||
|
build/obj/HandleTests/CreateProcess_Duplicate_XPPipeBug.o \
|
||||||
build/obj/HandleTests/CreateProcess_NewConsole.o \
|
build/obj/HandleTests/CreateProcess_NewConsole.o \
|
||||||
build/obj/HandleTests/CreateProcess_UseStdHandles.o \
|
build/obj/HandleTests/CreateProcess_UseStdHandles.o \
|
||||||
build/obj/HandleTests/MiscTests.o \
|
build/obj/HandleTests/MiscTests.o \
|
||||||
|
@ -346,7 +346,7 @@ On Windows XP, `CreateProcess` fails to propagate a handle in this situation:
|
|||||||
In this situation, Windows XP will set the child process's standard handle to
|
In this situation, Windows XP will set the child process's standard handle to
|
||||||
`NULL`. The write end of the pipe works fine. Passing a `bInheritHandles`
|
`NULL`. The write end of the pipe works fine. Passing a `bInheritHandles`
|
||||||
of `TRUE` (and an inheritable pipe handle) works fine. Using
|
of `TRUE` (and an inheritable pipe handle) works fine. Using
|
||||||
`STARTF_USESTDHANDLES` also works. See `Test_CreateProcess_DefaultInherit`
|
`STARTF_USESTDHANDLES` also works. See `Test_CreateProcess_Duplicate_XPPipeBug`
|
||||||
in `misc/buffer-tests` for a test case.
|
in `misc/buffer-tests` for a test case.
|
||||||
|
|
||||||
### <a name="dupproc">`CreateProcess` duplicates `INVALID_HANDLE_VALUE` until Windows 8.1 [dupproc]</a>
|
### <a name="dupproc">`CreateProcess` duplicates `INVALID_HANDLE_VALUE` until Windows 8.1 [dupproc]</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user