Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

return an error status on error in rosbag#1257

Merged
dirk-thomas merged 1 commit intoros:lunar-develfrom
phil-marble:return_error_on_unindexed
Dec 13, 2017
Merged

return an error status on error in rosbag#1257
dirk-thomas merged 1 commit intoros:lunar-develfrom
phil-marble:return_error_on_unindexed

Conversation

@phil-marble
Copy link
Copy Markdown
Contributor

I added some sys.exit(1)'s to rosbag commands to help with scripting.
Specifically, I expected a call to rosbag info test.bag.active to
return an error when the bag needed re-indexing.

fixes #1256

@phil-marble
Copy link
Copy Markdown
Contributor Author

Hey there.. New here and interested in getting this fix into kinetic...

@wjwwood
Copy link
Copy Markdown
Member

wjwwood commented Dec 13, 2017

@phil-marble it typically takes a few days for someone to have time to review and either merge this or give you feedback on what needs to change. After merging, it will take a few weeks to a month to get into the public .deb files. It might take slightly longer during this part of the year due to people traveling for the holidays.

@phil-marble
Copy link
Copy Markdown
Contributor Author

Thanks @wjwwood ! It's not a huge rush, just wondering about process.

I submitted this PR against the default branch (lunar-devel.) How does the org manage cherry-picking to older versions?

Copy link
Copy Markdown
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

The change looks reasonable to me.

I only identified this line which might also benefit from using sys.exit instead of return:

https://github.com/phil-marble/ros_comm/blob/c7aee3043fc84fc80b6aae31e5dc7bf4d7a72d53/tools/rosbag/src/rosbag/rosbag_main.py#L298

I think sys.exit make more sense because of how the "cmd" functions are executed:

https://github.com/phil-marble/ros_comm/blob/c7aee3043fc84fc80b6aae31e5dc7bf4d7a72d53/tools/rosbag/src/rosbag/rosbag_main.py#L900

While this line (and few others that follow it) could (probably should) be converted to use sys.exit rather than exit:

https://github.com/phil-marble/ros_comm/blob/c7aee3043fc84fc80b6aae31e5dc7bf4d7a72d53/tools/rosbag/src/rosbag/rosbag_main.py#L493

After a quick scan I didn't see anything else that needed doing related to returning an error code when there's a problem.

I'll leave it up to one of the actual maintainers to review and approve this change however.

@wjwwood
Copy link
Copy Markdown
Member

wjwwood commented Dec 13, 2017

Opening against lunar-devel (or the latest branch) is the right thing to do. The maintainers will back port changes at their discretion or your request.


print('Try running \'rosbag check\' to create the necessary rule files or run \'rosbag fix\' with the \'--force\' option.')
os.remove(outname)
sys.exit(1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The indentation of this line uses a tab which isn't allowed in Python 3. Please change this to spaces.

@mikepurvis
Copy link
Copy Markdown
Member

👍

I added some sys.exit(1)'s to rosbag commands to help with scripting.
Specifically, I expected a call to `rosbag info test.bag.active` to
return an error when the bag needed re-indexing.
@phil-marble phil-marble force-pushed the return_error_on_unindexed branch from c7aee30 to 0df9572 Compare December 13, 2017 18:16
@phil-marble
Copy link
Copy Markdown
Contributor Author

removed the tab

@dirk-thomas
Copy link
Copy Markdown
Member

Thank you.

@dirk-thomas dirk-thomas merged commit 44b33aa into ros:lunar-devel Dec 13, 2017
@phil-marble phil-marble deleted the return_error_on_unindexed branch December 15, 2017 19:50
dirk-thomas pushed a commit that referenced this pull request Feb 9, 2018
I added some sys.exit(1)'s to rosbag commands to help with scripting.
Specifically, I expected a call to `rosbag info test.bag.active` to
return an error when the bag needed re-indexing.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants