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 of parent process
21 const std::string &path,
22 const Arguments &args);
23 /// launch process executing the file at given path with
24 /// given arguments and given environment
26 const std::string &path,
27 const Arguments &args,
28 const Environment &env);
32 /// write to the process' input stream
33 /// data is taken from given buffer, at most max_len bytes
34 /// @return the number of bytes written
35 std::size_t WriteIn(const void *buffer, std::size_t max_len);
36 /// close program's input stream
39 /// read from the process' output stream
40 /// data is stored in the given buffer, at most max_len bytes
41 /// @return the number of bytes read
42 std::size_t ReadOut(void *buffer, std::size_t max_len);
43 /// close program's output stream
46 /// read from the process' error stream
47 /// data is stored in the given buffer, at most max_len bytes
48 /// @return the number of bytes read
49 std::size_t ReadErr(void *buffer, std::size_t max_len);
50 /// close program's output stream
53 /// ask the process nicely to terminate
56 /// check if the process has terminated
58 /// wait until the process exits and fetch its exit status
63 std::unique_ptr<Impl> impl;