0
$\begingroup$

Rosanswers logo

When I kill the process tree of roslaunch I get an exit code of 0 indicating success, which is what I would expect.

However, when I run roslaunch and manually kill one of the nodes that have the required=true attribute in the launch file it causes roslaunch to shutdown. In this case roslaunch returns 0 as well although an error occurred. Is there a safe way to determine if the shutdown reason was "good"?


Originally posted by SR on ROS Answers with karma: 152 on 2015-10-14

Post score: 4

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

From this answer:

Btw, this behavior and the meaning of the numbers isn't specific to roslaunch; roslaunch is just reporting back the exit code that the process gave when it died.

So, if you have manually killed ROS-node with SIGINT (which corresponds to Ctrl-C), then most probably it was handled by roscpp signal handler that eventually made ros::ok() to return false and thus you program have terminated normally. (I assume you are handling messages with either while(ros::ok()){ros::spinOnce();} or just ros::spin())

Thus, sending a different signal, e.g. pkill -SIGTERM your_node, should change the exit code.

EDIT

Sorry, I am wrong. It doesn't work as expected. It looks like a bug or just a missed feature in roslaunch.


Originally posted by Boris with karma: 3060 on 2015-10-14

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by SR on 2015-10-14:
Thanks for your confirmation. I killed one required node (out of many) with kill <pid>. I am not sure how roslaunch forwards the kill message when itself is being killed (which would be the good case). But if only one required node is killed it should report an error instead.

Comment by Boris on 2015-10-15:
I would suggest to open an issue on GitHub here, so to officially confirm the bug and/or make a feature request.

Comment by sd1074 on 2016-10-28:
I faced the same issue and I believe it is an important feature missing in roslaunch. I submitted a feature request/but report here: https://github.com/ros/ros_comm/issues/919

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.