Open sd1074 opened 7 years ago
One could directly check the exit code of the started nodes as roslaunch prints the node's pid, but I don`t see a way to do this programmatically and agree that roslaunch should forward the exit code of the node. But what if multiple nodes have been started by roslaunch?
At least if a required node dies, I think it would be better if roslaunch returned any non-zero exit code instead of 0.
This makes it challenging to containerize ROS nodes or stacks.
[nodename] process has died [pid 136, exit code -6 ...
is what I see when a node has an unhandled exception, then the container goes down,
containername- exited with code 0
No obvious way to intercept this, either. Can't trust presence of stderr, as some applications will roslog error but then recover.
Was there a conclusion to this? I also want to be able to programmatically check whether or not a roslaunch failed. @dirk-thomas I see you added the enhancement tag - do you know if there is some way of getting the exit code of the child node?
I assume not at the moment. Please consider to contribute a pull request to enable this.
I might be able to do it if someone could point roughly in the stack where to look or what keywords to grep for.
@xkortex I'm also trying to get failed required nodes to make ci jobs fail, and started experimenting with this in https://github.com/lucasw/ros_comm/commit/0eb9ba4400e01cf2383387c3cb2e6a4f5cdff223 . Use with caution- there were some odd cases where roslaunch lost track of child processes but I think I'm avoiding that now.
@lucasw any update on your branch? is there anything we can do to assist you in getting this finalized/tested? i got here due to the same reason: a simple smoketest in ci :)
@betaboon I put it into a PR #2082
Currently (at least in my indigo installation), if one of the nodes launched by roslaunch dies due to an error or from a signal, roslaunch is able to catch that and report, but its exit code is still 0. This makes if hard to verify whether roslaunch was successful or not. I am not sure if it's a bug report or a feature request, but I think propagating required node's exit code to ros roslaunch exit code would be a useful imp.
The described behavior was confirmed here: http://answers.ros.org/question/219115/exit-code-of-roslaunch-shutdown-on-node-death/
It can also be easily verified with a simple launch file:
run it, then kill the node:
$ kill -9 <TURTLESIM_NODE_PID>
roslaunch then shuts down with:
The reported error code is:
I believe that even if not via exit code, there should be some easy mechanism to check whether roslaunch succeeded or failed (based on the required node exit code).