| 238 | } |
| 239 | |
| 240 | void SubProcess::exec() { |
| 241 | ceph_assert(is_child()); |
| 242 | |
| 243 | std::vector<const char *> args; |
| 244 | args.push_back(cmd.c_str()); |
| 245 | for (std::vector<std::string>::iterator i = cmd_args.begin(); |
| 246 | i != cmd_args.end(); |
| 247 | i++) { |
| 248 | args.push_back(i->c_str()); |
| 249 | } |
| 250 | args.push_back(NULL); |
| 251 | |
| 252 | int ret = execvp(cmd.c_str(), (char * const *)&args[0]); |
| 253 | ceph_assert(ret == -1); |
| 254 | |
| 255 | std::cerr << cmd << ": exec failed: " << cpp_strerror(errno) << "\n"; |
| 256 | _exit(EXIT_FAILURE); |
| 257 | } |
| 258 | |
| 259 | int SubProcess::join() { |
| 260 | ceph_assert(is_spawned()); |
no test coverage detected