ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Exit code of roslaunch shutdown on node death

asked 2015-10-14 07:36:43 -0500

SR gravatar image

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"?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-14 09:38:58 -0500

updated 2015-10-14 10:12:39 -0500

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.


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

edit flag offensive delete link more


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.

SR gravatar image SR  ( 2015-10-14 11:06:45 -0500 )edit

I would suggest to open an issue on GitHub here, so to officially confirm the bug and/or make a feature request.

Boris gravatar image Boris  ( 2015-10-15 16:14:53 -0500 )edit

I faced the same issue and I believe it is an important feature missing in roslaunch. I submitted a feature request/but report here:

sd1074 gravatar image sd1074  ( 2016-10-28 19:18:24 -0500 )edit

Question Tools



Asked: 2015-10-14 07:36:43 -0500

Seen: 7,313 times

Last updated: Oct 28 '16