18 #ifndef RAUL_PROCESS_HPP
19 #define RAUL_PROCESS_HPP
21 #include <sys/resource.h>
28 #include <boost/utility.hpp>
30 #include "raul/log.hpp"
47 static bool launch(
const std::string& command) {
48 const std::string executable = (command.find(
" ") != std::string::npos)
49 ? command.substr(0, command.find(
" "))
52 const std::string arguments = command.substr((command.find(
" ") + 1));
54 info <<
"Launching child process '" << executable <<
"' with arguments '"
55 << arguments <<
"'" << std::endl;
58 const int err = fork();
64 struct rlimit max_fds;
65 getrlimit(RLIMIT_NOFILE, &max_fds);
67 for (rlim_t fd = 3; fd < max_fds.rlim_cur; ++fd)
74 execlp(executable.c_str(), arguments.c_str(), NULL);
97 #endif // RAUL_PROCESS_HPP
static bool launch(const std::string &command)
Launch a sub process.
Definition: Process.hpp:47
A child process.
Definition: Process.hpp:39