Get correct return status of ROS launch
Context: I'm making a GUI to call roslaunch processes and alert the user if the ROSLaunch process fails. I create a subprocess and directly run roslaunch mypackage mylaunch.launch
and set up a callback for its return code. If the launch fails, I want to get the correct returncode so the user can be informed about it straight-away.
Problem: If my ros node, ran with a launch file, returns with status 1. eg.
[cam_1-2] process has died [pid 7345, exit code 1, cmd ........ etc.
but it seems that roslaunch intercepts that return code and unconditionally returns 0.
$ echo $?
0
I see that this issue was raised before in 2016 and a feature request followed but I can't see if there was any conclusion so I wanted to see if there was still no conclusion to this in 2020?
In summary: How can I programmatically get the return code of the underlying launch process? Can I tell roslaunch to transparently passthrough the return code of the process it is wrapping?
I realise that I could grep the output of the launch with a regex to get the PID of the underlying node(s) and then poll rosnode._succeed(pid)
to check if the node is still running but I'm really hoping that it won't come to that. Is there a better way?