MCPcopy Create free account
hub / github.com/HO-COOH/FastCopy / ProcessBase

Class ProcessBase

SpeedTest/Process.h:18–43  ·  view source on GitHub ↗

* @brief Encapsulate a process handle, should be inherited by other class */

Source from the content-addressed store, hash-verified

16 * @brief Encapsulate a process handle, should be inherited by other class
17 */
18 class ProcessBase
19 {
20 public:
21
22 /**
23 * @brief Wait for the process handle to exit
24 * @return the exit code of the process
25 */
26 [[maybe_unused]] int WaitForExit() const
27 {
28 WaitForSingleObject(m_processHandle, INFINITE);
29 DWORD exitCode{};
30 GetExitCodeProcess(m_processHandle, &exitCode);
31 CloseHandle(m_processHandle);
32 return exitCode;
33 }
34
35 [[nodiscard]] HANDLE Handle() const { return m_processHandle; }
36
37 void Terminate()
38 {
39 TerminateProcess(m_processHandle, 1);
40 }
41 protected:
42 HANDLE m_processHandle;
43 };
44}
45
46template<typename Char>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected