| 64 | } |
| 65 | |
| 66 | void test_read_all() |
| 67 | { |
| 68 | Popen p = Popen({"echo", "12345678"}, output{PIPE}); |
| 69 | |
| 70 | std::vector<char> buf(6); |
| 71 | int rbytes = util::read_all(p.output(), buf); |
| 72 | |
| 73 | std::string out(buf.begin(), buf.end()); |
| 74 | |
| 75 | assert(out == "12345678\n" && rbytes == 9); // echo puts a new line at the end of output |
| 76 | std::cout << "read_all() succeeded" << std::endl; |
| 77 | } |
| 78 | |
| 79 | void test_simple_cmd() |
| 80 | { |