-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathProcess.h
More file actions
39 lines (29 loc) · 915 Bytes
/
Copy pathProcess.h
File metadata and controls
39 lines (29 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef HACKLIB_PROCESS_H
#define HACKLIB_PROCESS_H
#include <string>
#include <vector>
#include <cstdint>
namespace hl
{
// Represents an operating system process.
class Process
{
public:
Process(const Process&) = delete;
Process(Process&& other) = default;
// Returns the PID.
int id() const { return m_id; }
// Waits for the process to exit and return its exit code.
int join();
private:
int m_id;
uintptr_t m_handle;
private:
Process(int id, uintptr_t handle) : m_id(id), m_handle(handle) {}
friend Process LaunchProcess(const std::string&, const std::vector<std::string>&, const std::string&);
};
// Starts a new process of the given command and args inside initialDirectory. Throws on error.
Process LaunchProcess(const std::string& command, const std::vector<std::string>& args = {},
const std::string& initialDirectory = "");
}
#endif