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