blob: 900a0b652c7bba6e26e7d348201eb2c68984eab2 (
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
|
#pragma once
#include <string>
#include <optional>
#include <string_view>
#include <unistd.h>
using namespace std;
class Process {
string execname;
optional<string> stderrRedirect;
pid_t pid = -1;
int infd = -1, outfd = -1;
string readBuf;
public:
Process(const string_view execname);
Process(const Process&) = delete;
Process(Process&&) = default;
void redirectStderr(const string_view fname);
void run();
void wait();
void stop();
void unStop();
void terminate();
pid_t getPid() const;
bool writeLine(const string_view line);
optional<string> readLine();
};
|