| 122 | } |
| 123 | |
| 124 | inline struct res exec(const std::string& cmd, const std::string& output_name) { |
| 125 | int pid; |
| 126 | auto fp = command::open(cmd, pid, output_name); |
| 127 | if (!fp) return {-1, ""}; |
| 128 | auto output = command::read(fp); |
| 129 | auto stat = command::close(fp, pid); |
| 130 | return {WEXITSTATUS(stat), output}; |
| 131 | } |
| 132 | |
| 133 | inline struct res execNoRead(const std::string& cmd) { |
| 134 | int pid; |
no test coverage detected