forked from eidheim/tiny-process-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.cpp
More file actions
22 lines (18 loc) · 673 Bytes
/
process.cpp
File metadata and controls
22 lines (18 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "process.hpp"
Process::Process(const std::string &command, const std::string &path,
std::function<void(const char* bytes, size_t n)> read_stdout,
std::function<void(const char* bytes, size_t n)> read_stderr,
bool open_stdin, size_t buffer_size):
closed(true), read_stdout(read_stdout), read_stderr(read_stderr), open_stdin(open_stdin), buffer_size(buffer_size) {
open(command, path);
async_read();
}
Process::~Process() {
close_fds();
}
Process::id_type Process::get_id() {
return data.id;
}
bool Process::write(const std::string &data) {
return write(data.c_str(), data.size());
}