| // Blocking read from the child. | // Blocking read from the child. | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| DWORD nBytesRead; | |||||
| DWORD nBytesRead, lastError; | |||||
| try { | try { | ||||
| // Broken pipe occurs when the child exits; this is not | // Broken pipe occurs when the child exits; this is not | ||||
| // necessarily an error condition. | // necessarily an error condition. | ||||
| if (GetLastError() != ERROR_BROKEN_PIPE) { | |||||
| lastError = GetLastError(); | |||||
| if ( (ERROR_BROKEN_PIPE != lastError) && | |||||
| (ERROR_SUCCESS != lastError) ){ | |||||
| errorText = "Error reading from the child process: "; | errorText = "Error reading from the child process: "; | ||||
| errorText += getErrorText(); | errorText += getErrorText(); | ||||
| // Thread was not commanded to stop; output error: Broken pipe | // Thread was not commanded to stop; output error: Broken pipe | ||||
| // occurs when the child exits; this is not an error | // occurs when the child exits; this is not an error | ||||
| // condition. | // condition. | ||||
| if (GetLastError() != ERROR_BROKEN_PIPE) { | |||||
| lastError = GetLastError(); | |||||
| if ( (ERROR_BROKEN_PIPE != lastError) && | |||||
| (ERROR_SUCCESS != lastError) ){ | |||||
| errorText = "Error reading from the child process: "; | |||||
| errorText = "Exception when reading from the child process: "; | |||||
| errorText += getErrorText(); | errorText += getErrorText(); | ||||
| } | } |