15 #ifndef OPENSCENARIO_INTERPRETER__RECORD_HPP_
16 #define OPENSCENARIO_INTERPRETER__RECORD_HPP_
20 #ifndef OPENSCENARIO_INTERPRETER_VERBOSE_RECORD
23 #include <sys/types.h>
26 #include <boost/algorithm/string.hpp>
39 inline auto start(
const std::vector<std::string> & args) -> pid_t
41 std::vector<std::string> command{
42 "python3", boost::algorithm::replace_all_copy(
concealer::dollar(
"which ros2"),
"\n",
""),
"bag",
45 command.insert(command.end(), args.begin(), args.end());
49 throw std::system_error(errno, std::system_category());
52 #ifndef OPENSCENARIO_INTERPRETER_VERBOSE_RECORD
53 if (
const auto fd = ::open(
"/dev/null", O_WRONLY)) {
54 ::dup2(fd, STDOUT_FILENO);
59 std::cerr << std::system_error(errno, std::system_category()).what() << std::endl;
60 std::exit(EXIT_FAILURE);
auto dollar(const std::string &command) -> std::string
Definition: execute.cpp:57
auto execute(const std::vector< std::string > &) -> int
Definition: execute.cpp:36
auto stop() -> void
Definition: record.cpp:27
pid_t process_id
Definition: record.cpp:25
auto start(const std::vector< std::string > &args) -> pid_t
Definition: record.hpp:39