Open 708yamaguchi opened 1 year ago
When I use serial_node.py from roslaunch, we cannot kill serial_node.py by Ctrl-c.
serial_node.py
This is because serial_node.py does not catch SystemExit exception caused by sys.exit(0) in txStopRequest. https://github.com/ros-drivers/rosserial/blob/c169ae2173dcfda7cee567d64beae45198459400/rosserial_python/nodes/serial_node.py#L94-L109
SystemExit
sys.exit(0)
txStopRequest
In this PR, I used rospy.on_shutdown instead of signal.signal(signal.SIGINT, self.txStopRequest), following 8fb7954 (#508) and https://github.com/ros-drivers/rosserial/pull/551 This change enables to kill serial_node.py by Ctrl-c.
rospy.on_shutdown
signal.signal(signal.SIGINT, self.txStopRequest)
8fb7954
Thank you very much for your help, @sktometometo
Thanks for this PR @708yamaguchi!
When I use
serial_node.py
from roslaunch, we cannot killserial_node.py
by Ctrl-c.This is because
serial_node.py
does not catchSystemExit
exception caused bysys.exit(0)
intxStopRequest
. https://github.com/ros-drivers/rosserial/blob/c169ae2173dcfda7cee567d64beae45198459400/rosserial_python/nodes/serial_node.py#L94-L109In this PR, I used
rospy.on_shutdown
instead ofsignal.signal(signal.SIGINT, self.txStopRequest)
, following8fb7954
(#508) and https://github.com/ros-drivers/rosserial/pull/551 This change enables to killserial_node.py
by Ctrl-c.Thank you very much for your help, @sktometometo