37 #include <sys/types.h>
40 #include <rclcpp/logger.hpp>
41 #include <rclcpp/logging.hpp>
42 #include <rclcpp/utilities.hpp>
56 RCLCPP_ERROR(
getLogger(),
"Warehouse connector not supported on Windows");
60 RCLCPP_ERROR(
getLogger(),
"Warehouse connector not supported on Windows");
76 kill(child_pid_, SIGTERM);
82 kill(child_pid_, SIGTERM);
87 RCLCPP_ERROR(
getLogger(),
"Error forking process.");
94 std::size_t exec_file_pos = dbexec_.find_last_of(
"/\\");
95 if (exec_file_pos != std::string::npos)
97 char** argv =
new char*[4];
98 std::size_t exec_length = 1 + dbexec_.length() - exec_file_pos;
99 argv[0] =
new char[1 + exec_length];
100 snprintf(argv[0], exec_length,
"%s", dbexec_.substr(exec_file_pos + 1).c_str());
102 argv[1] =
new char[16];
103 snprintf(argv[1], 15,
"--dbpath");
105 argv[2] =
new char[1024];
106 snprintf(argv[2], 1023,
"%s", dirname.c_str());
110 int code = execv(dbexec_.c_str(), argv);
116 "execv() returned " << code <<
", errno=" << errno <<
" string errno = " << strerror(errno));
123 using namespace std::chrono_literals;
124 rclcpp::sleep_for(1s);
WarehouseConnector(const std::string &dbexec)
bool connectToDatabase(const std::string &db_dirname)
rclcpp::Logger getLogger()
rclcpp::Logger getLogger(const std::string &name)
Creates a namespaced logger.