15 #ifndef CONCEALER__LAUNCH_HPP_
16 #define CONCEALER__LAUNCH_HPP_
18 #ifdef CONCEALER_ISOLATE_STANDARD_OUTPUT
21 #include <sys/types.h>
25 #include <boost/algorithm/string.hpp>
30 #include <system_error>
31 #include <type_traits>
36 template <
typename Parameters>
40 #ifdef CONCEALER_ISOLATE_STANDARD_OUTPUT
41 const std::string log_filename =
"/tmp/scenario_test_runner/autoware-output.txt";
42 const auto fd = ::open(log_filename.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
43 ::dup2(fd, STDOUT_FILENO);
44 ::dup2(fd, STDERR_FILENO);
48 const auto argv = [&]() {
49 auto argv = std::vector<std::string>();
51 argv.push_back(
"python3");
52 argv.push_back(boost::algorithm::replace_all_copy(
dollar(
"which ros2"),
"\n",
""));
53 argv.push_back(
"launch");
54 argv.push_back(package);
57 for (
const auto & parameter : parameters) {
58 argv.push_back(parameter);
65 throw std::system_error(errno, std::system_category());
67 std::cout << std::system_error(errno, std::system_category()).what() << std::endl;
68 std::exit(EXIT_FAILURE);
Definition: autoware.hpp:30
auto ros2_launch(const std::string &package, const std::string &file, const Parameters ¶meters)
Definition: launch.hpp:37
auto dollar(const std::string &command) -> std::string
Definition: execute.cpp:57
auto execute(const std::vector< std::string > &) -> int
Definition: execute.cpp:36
pid_t process_id
Definition: record.cpp:25
std::string string
Definition: junit5.hpp:26