Minor fix for Windows +stderr+ = +stdout+

db4
Slava Pestov 2008-02-03 14:47:44 -06:00
parent d92361286d
commit 9d0d371efc
2 changed files with 25 additions and 2 deletions

View File

@ -118,11 +118,22 @@ TUPLE: CreateProcess-args
: inherited-stderr ( args -- handle ) : inherited-stderr ( args -- handle )
drop STD_ERROR_HANDLE GetStdHandle ; 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 ) : redirect-stderr ( args -- handle )
+stderr+ get +stderr+ get
dup +stdout+ eq? [ dup +stdout+ eq? [
drop drop
CreateProcess-args-lpStartupInfo CreateProcess-args-lpStartupInfo duplicate-handle
STARTUPINFO-hStdOutput STARTUPINFO-hStdOutput
] [ ] [
GENERIC_WRITE CREATE_ALWAYS redirect GENERIC_WRITE CREATE_ALWAYS redirect

View File

@ -707,7 +707,19 @@ FUNCTION: BOOL DeleteFileW ( LPCTSTR lpFileName ) ;
! FUNCTION: DosPathToSessionPathA ! FUNCTION: DosPathToSessionPathA
! FUNCTION: DosPathToSessionPathW ! FUNCTION: DosPathToSessionPathW
! FUNCTION: DuplicateConsoleHandle ! FUNCTION: DuplicateConsoleHandle
! FUNCTION: DuplicateHandle
FUNCTION: BOOL DuplicateHandle (
HANDLE hSourceProcessHandle,
HANDLE hSourceHandle,
HANDLE hTargetProcessHandle,
LPHANDLE lpTargetHandle,
DWORD dwDesiredAccess,
BOOL bInheritHandle,
DWORD dwOptions ) ;
: DUPLICATE_CLOSE_SOURCE 1 ;
: DUPLICATE_SAME_ACCESS 2 ;
! FUNCTION: EncodePointer ! FUNCTION: EncodePointer
! FUNCTION: EncodeSystemPointer ! FUNCTION: EncodeSystemPointer
! FUNCTION: EndUpdateResourceA ! FUNCTION: EndUpdateResourceA