From c23d873af2c6528ddccd1588c3bac3bfb45a4692 Mon Sep 17 00:00:00 2001 From: Yadunund Date: Tue, 23 Jan 2024 22:55:21 +0800 Subject: [PATCH] Be clearer about return value from router process Signed-off-by: Yadunund --- rmw_zenoh_cpp/apps/init_rmw_zenoh_router.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rmw_zenoh_cpp/apps/init_rmw_zenoh_router.cpp b/rmw_zenoh_cpp/apps/init_rmw_zenoh_router.cpp index 30b67501..b664e423 100644 --- a/rmw_zenoh_cpp/apps/init_rmw_zenoh_router.cpp +++ b/rmw_zenoh_cpp/apps/init_rmw_zenoh_router.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include @@ -33,9 +34,15 @@ int Main(int, char **) // Execute zenohd command const std::string zenohd_cmd = "zenohd -c " + zenoh_router_config_path; const int ret = system(zenohd_cmd.c_str()); - if (ret != 0) { - std::cerr << "Failed to run zenoh router: " << zenohd_cmd << std::endl; + if (ret < 0) { + std::cerr << "Error running zenoh router via command: " << zenohd_cmd << std::endl; return ret; + } else { + if (WIFEXITED(ret)) { + std::cout << "Zenoh router exited normally." << std::endl; + } else { + std::cout << "Zenoh router exited abnormally with error code [" << ret << "]" << std::endl; + } } return 0; }