Skip to content

Commit

Permalink
Don't call shutdown() after an exception (#1400)
Browse files Browse the repository at this point in the history
(cherry picked from commit b9a7cfc)
  • Loading branch information
christophfroehlich authored and mergify[bot] committed Dec 6, 2024
1 parent 7904d4b commit 8d5f1e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,10 @@ def main(args=None):

try:
rclpy.spin(publisher_forward_position)
except KeyboardInterrupt:
except (KeyboardInterrupt, rclpy.executors.ExternalShutdownException):
print("Keyboard interrupt received. Shutting down node.")
except Exception as e:
print(f"Unhandled exception: {e}")
finally:
if rclpy.ok():
publisher_forward_position.destroy_node()
rclpy.shutdown()


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,10 @@ def main(args=None):

try:
rclpy.spin(publisher_joint_trajectory)
except KeyboardInterrupt:
except (KeyboardInterrupt, rclpy.executors.ExternalShutdownException):
print("Keyboard interrupt received. Shutting down node.")
except Exception as e:
print(f"Unhandled exception: {e}")
finally:
if rclpy.ok():
publisher_joint_trajectory.destroy_node()
rclpy.shutdown()


if __name__ == "__main__":
Expand Down

0 comments on commit 8d5f1e7

Please sign in to comment.