| 34 | } |
| 35 | |
| 36 | std::string popen_read(const std::string& cmd, int expect = 0) { |
| 37 | std::string ret; |
| 38 | puts(cmd.c_str()); |
| 39 | auto p = popen(cmd.c_str(), "r"); |
| 40 | char buffer[4096]; |
| 41 | while (fgets(buffer, sizeof(buffer), p) != NULL) { |
| 42 | ret += buffer; |
| 43 | puts(buffer); |
| 44 | } |
| 45 | pclose(p); |
| 46 | return ret; |
| 47 | } |
| 48 | |
| 49 | std::string libpath(uint64_t pid) { |
| 50 | auto path = |