Status exit code - #497
Open
dlech wants to merge 1 commit into
Open
Conversation
The status report event now also carries the exit code of the program that ran most recently. It is recorded just before clearing the user program running flag so that hosts always receive both in the same update. Stopping a program gives it a distinct exit code so that it can be told apart from a program that ran to completion.
dlech
force-pushed
the
status-exit-code
branch
from
September 12, 2026 15:01
fc4ed93 to
3269bf1
Compare
dlech
marked this pull request as ready for review
September 12, 2026 15:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This depends on #496 so includes those patches for now. The actual feature is just the last patch.
MicroPython v1.29 has a feature to allow getting the exit code from the runtime in embedded ports now. We can use this feature to pass that exit code to remote tools in order to provide users more helpful information on why their program ended.
I put it in the existing status event type since that already contains a flag that says if the user program is running or not. So this avoids any race conditions in getting this information out.