|  |  | @@ -1455,20 +1455,64 @@ namespace CodeDweller { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | // Blocking read from the child. | 
		
	
		
			
			|  |  |  | #ifdef _WIN32 | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | DWORD nBytesRead; | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | if (!ReadFile(inputHandle, | 
		
	
		
			
			|  |  |  | bufferPtr, | 
		
	
		
			
			|  |  |  | bufferCapacity, | 
		
	
		
			
			|  |  |  | &nBytesRead, | 
		
	
		
			
			|  |  |  | NULL)) { | 
		
	
		
			
			|  |  |  | try { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | if (stopReaderFlag) { | 
		
	
		
			
			|  |  |  | break; | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | DWORD bytesAvailable; | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | if (!PeekNamedPipe(inputHandle, | 
		
	
		
			
			|  |  |  | NULL, | 
		
	
		
			
			|  |  |  | 0, | 
		
	
		
			
			|  |  |  | NULL, | 
		
	
		
			
			|  |  |  | &bytesAvailable, | 
		
	
		
			
			|  |  |  | NULL)) { | 
		
	
		
			
			|  |  |  | throw std::runtime_error("Error from PeekNamedPipe:  " + | 
		
	
		
			
			|  |  |  | getErrorText()); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | // Is data available? | 
		
	
		
			
			|  |  |  | if (0 == bytesAvailable) { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | // No.  Wait and try again. | 
		
	
		
			
			|  |  |  | pollTimer.pause(); | 
		
	
		
			
			|  |  |  | continue; | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | if (!ReadFile(inputHandle, | 
		
	
		
			
			|  |  |  | bufferPtr, | 
		
	
		
			
			|  |  |  | bufferCapacity, | 
		
	
		
			
			|  |  |  | &nBytesRead, | 
		
	
		
			
			|  |  |  | NULL)) { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | if (stopReaderFlag) { | 
		
	
		
			
			|  |  |  | break; | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | // Broken pipe occurs when the child exits; this is not | 
		
	
		
			
			|  |  |  | // necessarily an error condition. | 
		
	
		
			
			|  |  |  | if (GetLastError() != ERROR_BROKEN_PIPE) { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | errorText = "Error reading from the child process:  "; | 
		
	
		
			
			|  |  |  | errorText += getErrorText(); | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | break; | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | } catch(...) { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | // Some error occurred. | 
		
	
		
			
			|  |  |  | if (stopReaderFlag) { | 
		
	
		
			
			|  |  |  | break; | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | // Broken pipe occurs when the child exits; this is not | 
		
	
		
			
			|  |  |  | // necessarily an error condition. | 
		
	
		
			
			|  |  |  | // Thread was not commanded to stop; output error: Broken pipe | 
		
	
		
			
			|  |  |  | // occurs when the child exits; this is not an error | 
		
	
		
			
			|  |  |  | // condition. | 
		
	
		
			
			|  |  |  | if (GetLastError() != ERROR_BROKEN_PIPE) { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | errorText = "Error reading from the child process:  "; | 
		
	
	
		
			
			|  |  | @@ -1476,6 +1520,7 @@ namespace CodeDweller { | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | // Exit the thread. | 
		
	
		
			
			|  |  |  | break; | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | } |