src/process.h

changeset 4
82680ce258d6
parent 3
c87bde92805f
equal deleted inserted replaced
3:c87bde92805f 4:82680ce258d6
29 #include <vector> 29 #include <vector>
30 30
31 namespace fm { 31 namespace fm {
32 32
33 class process final { 33 class process final {
34 std::string m_path; 34 std::string m_path = "/bin/false";
35 std::string m_dir = ".";
35 std::string m_output; 36 std::string m_output;
36 public: 37 public:
37 explicit process(std::string path); 38 void setbin(std::string path);
38 ~process() = default; 39 void chdir(std::string path);
39 40
40 [[nodiscard]] bool exec(std::vector<std::string> args); 41 [[nodiscard]] int exec(std::vector<std::string> args, bool capture = false);
42 [[nodiscard]] int exec_log(std::vector<std::string> args) {
43 return exec(std::move(args), true);
44 }
41 [[nodiscard]] const std::string &output() const; 45 [[nodiscard]] const std::string &output() const;
42 }; 46 };
43 47
44 } 48 }
45 49

mercurial