1 #ifndef BLANK_APP_PROCESS_HPP_
2 #define BLANK_APP_PROCESS_HPP_
14 using Arguments = std::vector<std::string>;
15 using Environment = std::vector<std::string>;
18 /// launch process executing the file at given path with
19 /// given arguments and environment
21 const std::string &path,
22 const Arguments &args,
23 const Environment &env);
27 /// write to the process' input stream
28 /// data is taken from given buffer, at most max_len bytes
29 /// @return the number of bytes written
30 std::size_t WriteIn(const void *buffer, std::size_t max_len);
31 /// close program's input stream
34 /// read from the process' output stream
35 /// data is stored in the given buffer, at most max_len bytes
36 /// @return the number of bytes read
37 std::size_t ReadOut(void *buffer, std::size_t max_len);
38 /// close program's output stream
41 /// read from the process' error stream
42 /// data is stored in the given buffer, at most max_len bytes
43 /// @return the number of bytes read
44 std::size_t ReadErr(void *buffer, std::size_t max_len);
45 /// close program's output stream
48 /// ask the process nicely to terminate
51 /// check if the process has terminated
53 /// wait until the process exits and fetch its exit status
58 std::unique_ptr<Impl> impl;