I'd like to kill a rosbag
instance gracefully via terminal.
Gracefully means in that case, that the rosbag
file doesn't have the suffix .active after kill.
so I do the following from terminal to send the recommended SIGINT
to rosbag:
$ rosbag record /some/topic &
$ RPID=$!
$ # do some stuff
$ kill -2 $RPID
Unfortunately, the bag remains active and it can happen that not everything was stored to the disk. However, if I put rosbag into a launch file, it seems to work:
$ roslaunch rosbag_record.launch &
$ LPID=$!
$ # do some stuff
$ kill -2 $LPID
Now the rosbag stays intact and it was stored without the active suffix.
Now the interesting question is, what am I doing wrong in the first case.
I though that killing a launch file, and in this case killing the roscore, raises a ros::shutdown()
which causes a SIGINT
in all processes.
But the manual way by using kill
seems to has a different behavior.