blob: 341afc5c1caa8ff35441f400b3bdbeef08d86dcf (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#pragma once
#include "Base.h"
#include "String.h"
#include <chrono>
#include <optional>
#include <vector>
namespace cru {
enum class PlatformSubProcessStatus {
/**
* @brief The process has not been created and started.
*/
Prepare,
/**
* @brief The process is running now.
*/
Running,
/**
* @brief The process has been exited.
*/
Exited,
};
/**
* Interface of a platform process. It is one-time, which means it starts and
* exits and can't start again.
*/
struct IPlatformSubProcess : virtual Interface {
/**
* Create and start a real process.
*/
void Start(String program, std::vector<String> arguments,
std::vector<String> environments);
void Wait(std::optional<std::chrono::milliseconds> wait_time);
void Reap();
PlatformSubProcessStatus GetStatus() const;
int GetExitCode() const;
};
class CRU_BASE_API SubProcess : public Object {
public:
SubProcess();
CRU_DELETE_COPY(SubProcess)
SubProcess(SubProcess&& other);
SubProcess& operator=(SubProcess&& other);
~SubProcess();
private:
};
} // namespace cru
|