It seems trying to second-guess win32api plays against you, so it's best to assume it worked when the functions say it did.

(Fixes the stdout redirection for me.)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2020 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2009-10-17 16:19:13 +00:00
parent 1ae5d07a3f
commit bdad3bfa97
1 changed files with 2 additions and 7 deletions

View File

@ -208,14 +208,9 @@ WinPipeRedirection::WinPipeRedirection( FILE* stdstream ) :
throw Exception::Win32Error( "SetStdHandle failed." );
// In some cases GetStdHandle can fail, even when the one we just assigned above is valid.
HANDLE newhandle = GetStdHandle(stdhandle);
if( newhandle == INVALID_HANDLE_VALUE )
throw Exception::Win32Error( "GetStdHandle failed." );
// Regardless, it seems to work right so if SetStdHandle was successful, assume it worked.
if( newhandle == NULL )
throw Exception::RuntimeError( "GetStdHandle returned NULL." ); // not a Win32error (no error code)
m_crtFile = _open_osfhandle( (intptr_t)newhandle, _O_TEXT );
m_crtFile = _open_osfhandle( (intptr_t)m_writepipe, _O_TEXT );
if( m_crtFile == -1 )
throw Exception::RuntimeError( "_open_osfhandle returned -1." );