------------------------------------------------------------------------------
| 137 | |
| 138 | //------------------------------------------------------------------------------ |
| 139 | void vtkWin32ProcessOutputWindow::Write(const char* data, size_t length) |
| 140 | { |
| 141 | if (data && length) |
| 142 | { |
| 143 | // Initialize the output pipe the first time. |
| 144 | if (this->Broken || (!this->OutputPipe && !this->Initialize())) |
| 145 | { |
| 146 | this->Broken = 1; |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | // Write the data to the pipe. If it breaks, close the pipe. |
| 151 | DWORD nWritten; |
| 152 | if (!WriteFile(this->OutputPipe, data, (DWORD)length, &nWritten, 0)) |
| 153 | { |
| 154 | this->Broken = 1; |
| 155 | CloseHandle(this->OutputPipe); |
| 156 | this->OutputPipe = 0; |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | VTK_ABI_NAMESPACE_END |