-
-
Notifications
You must be signed in to change notification settings - Fork 414
Improve cli exit codes #2221
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
Improve cli exit codes #2221
Conversation
da20369
to
d20e576
Compare
Thank you for working on this. When the compilation fails, I see the expected non-zero exit code ✅ from the CLI, but the console output❓ is strange. Do you know if this is expected?
Thank you! I used d20e576. (I continue with the review...) |
I get the same exit code 9 when the platform is not installed, the FQBN is invalid, and the sketch has compiler errors:
|
I do not know if this is expected, but when I run the arduino-cli/internal/cli/feedback/errorcodes.go Lines 43 to 44 in d20e576
|
Yes, it's expected because some logic that seems easy to distinguish comes from another component that handles the compile action in this case. We centralized under the At the moment, we prefer to not implement this. We can re-evaluate this feature in the future depending on how many requests come from the community. |
Please check if the PR fulfills these requirements
See how to contribute
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)configuration.schema.json
updated if new parameters are added.What kind of change does this PR introduce?
It adds different cmd exit codes.
What is the current behavior?
Right now almost every error exit code is identified with the number 1
What is the new behavior?
The new behavior expands the exit code numbers to distinguish better what kind of error we had. This is especially useful in commands like
compile
that perform various operations and it's not clear if it is something related to the compilation itself or other components it's using like sketches file problems or upload issues.Does this PR introduce a breaking change, and is titled accordingly?
Other information
I've experimented a bit at trying to throw very precise exit codes for every error we had, but it becomes way too unmanageable (plus we have limited exit code numbers available in UNIX systems)
The tradeoff is having one exit code that expresses an error happening in a specific component. For example, if the compile commands use sketch, upload, and compile components and one of them fails we can return their associated exit codes.
Open points:
core install
,core upgrade
, orboard details
as their logic uses only their dedicated component.I'll leave this PR open for feedback, especially from @kittaakos