Undo handle duplication

db4
Slava Pestov 2008-02-03 15:14:48 -06:00
parent 62bbb0597e
commit bae79b80e3
1 changed files with 1 additions and 13 deletions

View File

@ -118,23 +118,11 @@ TUPLE: CreateProcess-args
: inherited-stderr ( args -- handle )
drop STD_ERROR_HANDLE GetStdHandle ;
: duplicate-handle ( handle -- handle )
GetCurrentProcess
swap
GetCurrentProcess
f <void*> [
0
TRUE
DUPLICATE_SAME_ACCESS
DuplicateHandle win32-error=0/f
] keep *void* ;
: redirect-stderr ( args -- handle )
+stderr+ get
dup +stdout+ eq? [
drop
CreateProcess-args-lpStartupInfo duplicate-handle
STARTUPINFO-hStdOutput
CreateProcess-args-lpStartupInfo STARTUPINFO-hStdOutput
] [
GENERIC_WRITE CREATE_ALWAYS redirect
swap inherited-stderr ?closed