comparison host/tools/Utils/common/Subprocess.cpp @ 177:4c750ce71ae3

Merge from eCos master repository on 2001-08-10-19:22:57-BST
author jlarmour
date Fri, 10 Aug 2001 19:27:55 +0000
parents 489eb5632bc3
children a22e535e2a4c
comparison
equal deleted inserted replaced
176:3902ef905c9c 177:4c750ce71ae3
257 257
258 TRACE(_T("Reading from process %d\n"),m_idProcess); 258 TRACE(_T("Reading from process %d\n"),m_idProcess);
259 259
260 DWORD dwAvail; 260 DWORD dwAvail;
261 261
262 DWORD dwExitCode;
263
262 while (!m_bKillThread && m_pfnContinue(m_pContinuationFuncParam) && ::PeekNamedPipe(m_hrPipe, NULL, 0, 0, &dwAvail, NULL)){ 264 while (!m_bKillThread && m_pfnContinue(m_pContinuationFuncParam) && ::PeekNamedPipe(m_hrPipe, NULL, 0, 0, &dwAvail, NULL)){
263 //TRACE(_T("P%d\n"),dwAvail); 265 //TRACE(_T("P%d\n"),dwAvail);
264 if(dwAvail){ 266 if(dwAvail){
265 dwAvail=MIN(dwAvail,80); // Read a maximum of 80 characters at a time 267 dwAvail=MIN(dwAvail,80); // Read a maximum of 80 characters at a time
266 DWORD dwRead; 268 DWORD dwRead;
272 break; 274 break;
273 } 275 }
274 buf[dwRead]='\0'; 276 buf[dwRead]='\0';
275 Output(String::CStrToUnicodeStr(buf)); 277 Output(String::CStrToUnicodeStr(buf));
276 delete [] buf; 278 delete [] buf;
277 } else if(!ProcessAlive()){ 279 }
278 TRACE(_T("m_bThreadTerminated=%d\n"),m_bThreadTerminated); 280 else if (!ProcessAlive())
279 break; 281 {
280 } else { 282 TRACE(_T("m_bThreadTerminated=%d\n"),m_bThreadTerminated);
283 break;
284 }
285 // Fix for hanging in an endless loop under Windows ME, by Bill Diehls <billabloke@yahoo.com>
286 else if (::GetExitCodeProcess(m_hProcess, &dwExitCode) && dwExitCode!=STILL_ACTIVE)
287 {
288 break;
289 }
290 else
291 {
281 CeCosThreadUtils::Sleep(250); 292 CeCosThreadUtils::Sleep(250);
282 } 293 }
283 } 294 }
284 295
285 DWORD dwExitCode;
286 ::GetExitCodeProcess(m_hProcess, &dwExitCode); 296 ::GetExitCodeProcess(m_hProcess, &dwExitCode);
287 m_nExitCode=dwExitCode; 297 m_nExitCode=dwExitCode;
288 298
289 #ifdef _DEBUG 299 #ifdef _DEBUG
290 String str; 300 String str;