Revert to fix win 9x

This commit is contained in:
Ken Martin 2002-10-02 17:46:21 -04:00
parent 5ce73bdd14
commit 9f5cf38290

View File

@ -68,15 +68,6 @@ bool cmWin32ProcessExecution::Wait(int timeout)
*/
static void *_PyPopenProcs = NULL;
static bool IsWinNT()
//check if we're running NT
{
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(osv);
GetVersionEx(&osv);
return (osv.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
static BOOL RealPopenCreateProcess(const char *cmdstring,
const char *path,
const char *szConsoleSpawn,
@ -218,6 +209,7 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
CloseHandle(piProcInfo.hThread);
/* Return process handle */
*hProcess = piProcInfo.hProcess;
//std::cout << "Process created..." << std::endl;
return TRUE;
}
win32_error("CreateProcess", s2);
@ -240,22 +232,9 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
int fd1, fd2, fd3;
//FILE *f1, *f2, *f3;
SECURITY_DESCRIPTOR sd;
if (IsWinNT())
//initialize security descriptor (Windows NT)
{
InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&sd, true, NULL, false);
saAttr.lpSecurityDescriptor = &sd;
}
else saAttr.lpSecurityDescriptor = NULL;
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
saAttr.bInheritHandle = true;
//saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
//saAttr.bInheritHandle = TRUE;
//saAttr.lpSecurityDescriptor = NULL;
saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL;
if (!CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0))
{
@ -533,16 +512,22 @@ bool cmWin32ProcessExecution::PrivateClose(int timeout)
std::string output = "";
bool done = false;
while(!done)
{
char buffer[1023]="";
int len = 0;
Sleep(1);
Sleep(10);
bool have_some = false;
len = read(this->m_pStdErr, buffer, 1023);
if ( len > 0 )
struct _stat fsout;
struct _stat fserr;
int rout = _fstat(this->m_pStdOut, &fsout);
int rerr = _fstat(this->m_pStdErr, &fserr);
if ( rout && rerr )
{
break;
}
if (fserr.st_size > 0)
{
char buffer[1023];
int len = read(this->m_pStdErr, buffer, 1023);
buffer[len] = 0;
if ( this->m_Verbose )
{
@ -551,9 +536,10 @@ bool cmWin32ProcessExecution::PrivateClose(int timeout)
output += buffer;
have_some = true;
}
len = read(this->m_pStdOut, buffer, 1023);
if ( len > 0 )
if (fsout.st_size > 0)
{
char buffer[1023];
int len = read(this->m_pStdOut, buffer, 1023);
buffer[len] = 0;
if ( this->m_Verbose )
{