我将尝试在嵌套的try...catch中使用ROS_INFO_STREAM,但我只能得到顶层输出。
以下是一小段最简代码:
我的猜测是ROS_ERROR_STREAM看起来是带缓冲的,但作为错误输出它不应该是这样的。我正在运行ROS Groovy。
以下是一小段最简代码:
void failure()
{
try
{
// throw std::length_error
std::string("abc").substr(10);
}
catch (...)
{
ROS_ERROR_STREAM("ROS failure()"); // print OK
std::cout << "cout failure()" << std::endl; // print OK
throw; // re-throw the exception
}
}
int main()
{
try
{
ROS_ERROR_STREAM("ROS calling"); // print OK
failure(); // will throw
}
catch (...)
{
ROS_ERROR_STREAM("ROS call function"); // <-- NO print
std::cout << "cout call function" << std::endl; // print OK
}
return 0;
}
输出:
ROS calling
ROS failure()
cout failure()
cout call function
我的猜测是ROS_ERROR_STREAM看起来是带缓冲的,但作为错误输出它不应该是这样的。我正在运行ROS Groovy。