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

mavlogdump: Use sys.exit instead of quit on error #930

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

shancock884
Copy link
Contributor

@shancock884 shancock884 commented Mar 17, 2024

As @peterbarker pointed out in comments on #928, quit() should not be normally be used in scripts, but instead sys.exit() is preferred.
This PR replaces the uses of quit() and exit() in mavlogdump with sys.exit(1) - all uses are error conditions, hence using return code 1.
I tested a few of the error conditions out, and checked they return neatly with the correct error code set, for example:

$ mavlogdump.py --format=csv file.BIN 
Need exactly one type when dumping CSV from bin file
$ echo $?
1

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

LGTM

@peterbarker peterbarker merged commit 5cedc2e into ArduPilot:master Mar 17, 2024
12 checks passed
@peterbarker
Copy link
Contributor

Merged, thanks!

@shancock884 shancock884 deleted the sys-exit-from-mavlogdump branch March 18, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants