| 421 | } |
| 422 | |
| 423 | inline static void* ReadStream(void* data) noexcept { |
| 424 | TPipePump* pump = reinterpret_cast<TPipePump*>(data); |
| 425 | try { |
| 426 | int bytes = 0; |
| 427 | TBuffer buffer(DATA_BUFFER_SIZE); |
| 428 | |
| 429 | while (true) { |
| 430 | bytes = pump->Pipe->Read(buffer.Data(), buffer.Capacity()); |
| 431 | if (bytes > 0) { |
| 432 | pump->OutputStream->Write(buffer.Data(), bytes); |
| 433 | } else { |
| 434 | break; |
| 435 | } |
| 436 | } |
| 437 | if (pump->Pipe->IsOpen()) { |
| 438 | pump->Pipe->Close(); |
| 439 | } |
| 440 | } catch (...) { |
| 441 | pump->InternalError = CurrentExceptionMessage(); |
| 442 | } |
| 443 | return nullptr; |
| 444 | } |
| 445 | |
| 446 | inline static void* WriteStream(void* data) noexcept { |
| 447 | TPipePump* pump = reinterpret_cast<TPipePump*>(data); |