MCPcopy Create free account
hub / github.com/deskflow/deskflow / createPipes

Method createPipes

src/lib/platform/MSWindowsProcess.cpp:191–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void 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
219std::wstring MSWindowsProcess::readStdOutput()
220{

Callers

nothing calls this directly

Calls 1

windowsErrorToStringFunction · 0.85

Tested by

no test coverage detected