Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of SIGINT by router executable #99

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions rmw_zenoh_cpp/apps/init_rmw_zenoh_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include <stdlib.h>
#include <sys/wait.h>

#include <iostream>
#include <string>
Expand All @@ -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;
}
Expand Down
Loading