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>
30 #include <rclcpp/logging.hpp>
40 inline auto start(
const std::vector<std::string> & args) -> pid_t
42 std::vector<std::string> command{
43 "python3", boost::algorithm::replace_all_copy(
concealer::dollar(
"which ros2"),
"\n",
""),
"bag",
46 command.insert(command.end(), args.begin(), args.end());
50 throw std::system_error(errno, std::system_category());
53 #ifndef OPENSCENARIO_INTERPRETER_VERBOSE_RECORD
54 if (
const auto fd = ::open(
"/dev/null", O_WRONLY)) {
55 ::dup2(fd, STDOUT_FILENO);
61 rclcpp::get_logger(
"record"), std::system_error(errno, std::system_category()).what());
62 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:40