Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python nodes SIGINT handling #539

Merged
merged 2 commits into from
Nov 10, 2021

Conversation

ivanpauno
Copy link
Member

Related to ros2/rclpy#844.

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@ivanpauno ivanpauno added the enhancement New feature or request label Nov 8, 2021
@ivanpauno ivanpauno requested a review from hidmic November 8, 2021 21:29
@ivanpauno ivanpauno self-assigned this Nov 8, 2021
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as in ros2/system_tests#490 (review).

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@ivanpauno ivanpauno requested a review from hidmic November 9, 2021 16:53
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending green CI

@ivanpauno ivanpauno merged commit 4581480 into master Nov 10, 2021
@delete-merged-branch delete-merged-branch bot deleted the ivanpauno/shutdown-asynchronously-when-sigint branch November 10, 2021 16:13
node.destroy_node()
rclpy.shutdown()
except ExternalShutdownException:
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to comment on an old ticket, but why are we exiting with error code 1? IIUC, ExternalShutdownException is something we should expect as part of the normal shutdown sequence here.

It seems to me that all of the demos should be updated to look like,

try:
    rclpy.spin(node)
except (KeyboardInterrupt, ExternalShutdownException):
    pass

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #581

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants