Skip to content

Commit

Permalink
Don't call shutdown() after an exception (#1400) (#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 6, 2024
1 parent 7904d4b commit ef8f100
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 ef8f100

Please sign in to comment.