diff --git a/src/message_handler.cpp b/src/message_handler.cpp index d493556..d8cb447 100644 --- a/src/message_handler.cpp +++ b/src/message_handler.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include "tcp_service.hpp" #include "tcp_client.hpp" @@ -44,36 +43,36 @@ }); // 拉起第三方脚本 - std::thread script_thread([] { - fs::current_path(Config::SLAM_SCRIPT_PATH); - for (const auto &entry: fs::directory_iterator(fs::current_path())) { - if (entry.is_regular_file() && entry.path().extension() == ".sh") { - const auto script_path = entry.path(); - if (const pid_t pid = fork(); pid == 0) { - // 子进程执行脚本 - std::ostringstream cmd_ss; - cmd_ss << "./" - << script_path.filename().string() - << " > " - << Config::SLAM_LOG_FILE << " 2>&1"; - const std::string command = cmd_ss.str(); - - execl("/bin/sh", "sh", "-c", command.c_str(), nullptr); - // 如果执行失败 - std::cerr << "\033[33m" - << "Failed to execute script." - << "\033[0m" << std::endl; - exit(EXIT_FAILURE); - } - break; - } - } - }); + // std::thread script_thread([] { + // fs::current_path(Config::SLAM_SCRIPT_PATH); + // for (const auto &entry: fs::directory_iterator(fs::current_path())) { + // if (entry.is_regular_file() && entry.path().extension() == ".sh") { + // const auto script_path = entry.path(); + // if (const pid_t pid = fork(); pid == 0) { + // // 子进程执行脚本 + // std::ostringstream cmd_ss; + // cmd_ss << "./" + // << script_path.filename().string() + // << " > " + // << Config::SLAM_LOG_FILE << " 2>&1"; + // const std::string command = cmd_ss.str(); + // + // execl("/bin/sh", "sh", "-c", command.c_str(), nullptr); + // // 如果执行失败 + // std::cerr << "\033[33m" + // << "Failed to execute script." + // << "\033[0m" << std::endl; + // exit(EXIT_FAILURE); + // } + // break; + // } + // } + // }); // 等待所有线程完成 service_thread.join(); client_thread.join(); gas_serial_port_thread.join(); - script_thread.join(); + // script_thread.join(); return 0; }