Skip to content

Commit

Permalink
Call rcl_logging_configure/rcl_logging_fini when init/shutdown
Browse files Browse the repository at this point in the history
Due to change of ros2/rcl#579, calling rcl_logging_configure/rcl_logging_fini
when init/shutdown.

Fix RobotWebTools#651
  • Loading branch information
Minggang Wang committed May 7, 2020
1 parent 7b75f0c commit c312d16
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rcl_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <rcl/error_handling.h>
#include <rcl/expand_topic_name.h>
#include <rcl/graph.h>
#include <rcl/logging.h>
#include <rcl/node.h>
#include <rcl/rcl.h>
#include <rcl/validate_topic_name.h>
Expand Down Expand Up @@ -98,6 +99,10 @@ NAN_METHOD(Init) {
rcl_init(argc, argc > 0 ? argv : nullptr, &init_options, context),
rcl_get_error_string().str);

THROW_ERROR_IF_NOT_EQUAL(
RCL_RET_OK, rcl_logging_configure(&context->global_arguments, &allocator),
rcl_get_error_string().str);

for (int i = 0; i < argc; i++) {
free(argv[i]);
}
Expand Down Expand Up @@ -1253,6 +1258,8 @@ NAN_METHOD(Shutdown) {
reinterpret_cast<rcl_context_t*>(context_handle->ptr());
THROW_ERROR_IF_NOT_EQUAL(rcl_shutdown(context), RCL_RET_OK,
rcl_get_error_string().str);
THROW_ERROR_IF_NOT_EQUAL(rcl_logging_fini(), RCL_RET_OK,
rcl_get_error_string().str);

if (g_sigint_gc) {
THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK, rcl_guard_condition_fini(g_sigint_gc),
Expand Down

0 comments on commit c312d16

Please sign in to comment.