summaryrefslogtreecommitdiff
path: root/src/ProcessLinux.hpp
blob: 296453b34e5b28d53060392b37e824fb689c672b (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
#include "Process.hpp"
#include <chrono>
#include <fcntl.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>

namespace uciadapter {

class ProcessLinux : public Process {
  /// @brief Create pipe to engine stdin
  int in_fd[2];
  /// @brief Create pipe to the engine stdout
  int out_fd[2];
  /// @brief Writing buffer
  char buffer[BUFFER_SIZE];
  /// @brief Contains engine pid
  pid_t pid;

public:
  ProcessLinux();
  void Kill();
  void Start(std::string);
  std::string ReadLine();
  void Write(std::string);
};
}; // namespace uciadapter