| 30 | }; |
| 31 | |
| 32 | Pipe::Pipe(const std::string& pipePath) |
| 33 | { |
| 34 | _pipeHandle = win32_handle(INVALID_HANDLE_VALUE); |
| 35 | |
| 36 | while(_pipeHandle.get() == INVALID_HANDLE_VALUE){ |
| 37 | |
| 38 | _pipeHandle = win32_handle(CreateFileA(pipePath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr)); |
| 39 | |
| 40 | if(_pipeHandle.get() == INVALID_HANDLE_VALUE){ |
| 41 | if(GetLastError() == ERROR_PIPE_BUSY){ |
| 42 | WaitNamedPipeA(pipePath.c_str(),100); |
| 43 | continue; |
| 44 | }else{ |
| 45 | throw std::system_error(std::error_code(GetLastError(), std::system_category()), "Failed to open pipe"); |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | MessageBuffer Pipe::ReadAll(){ |
| 52 | |