| 189 | } |
| 190 | |
| 191 | void MSWindowsProcess::createPipes() |
| 192 | { |
| 193 | SECURITY_ATTRIBUTES saAttr; |
| 194 | saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); |
| 195 | saAttr.bInheritHandle = TRUE; |
| 196 | saAttr.lpSecurityDescriptor = nullptr; |
| 197 | |
| 198 | if (!CreatePipe(&m_outputPipe, &m_stdOutput, &saAttr, 0)) { |
| 199 | LOG_ERR("could not create output pipe"); |
| 200 | throw std::runtime_error(windowsErrorToString(GetLastError())); |
| 201 | } |
| 202 | |
| 203 | if (!CreatePipe(&m_errorPipe, &m_stdError, &saAttr, 0)) { |
| 204 | LOG_ERR("could not create error pipe"); |
| 205 | throw std::runtime_error(windowsErrorToString(GetLastError())); |
| 206 | } |
| 207 | |
| 208 | // Set the pipes to non-blocking mode |
| 209 | DWORD mode = PIPE_NOWAIT; |
| 210 | if (!SetNamedPipeHandleState(m_outputPipe, &mode, nullptr, nullptr)) { |
| 211 | throw std::runtime_error(windowsErrorToString(GetLastError())); |
| 212 | } |
| 213 | |
| 214 | if (!SetNamedPipeHandleState(m_errorPipe, &mode, nullptr, nullptr)) { |
| 215 | throw std::runtime_error(windowsErrorToString(GetLastError())); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | std::wstring MSWindowsProcess::readStdOutput() |
| 220 | { |
nothing calls this directly
no test coverage detected