Skip to content

runtime/exitcodes: Set exit code according to the SystemExit exception. #15863

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RealJohnSmith
Copy link

Summary

Add abort setup code (nlr_set_abort) to standard runtime. This makes the standard runtime respond to abort signal without any further modifications.

  • When aborted, the program exits with 137 exit code (configurable, same as posix sig abort), to differentiate from a normal shutdown.
  • When exited by exception/crash, the program will exit with exit code 1 (configurable)
  • When exited by exception KeyboardInterrupt, the program will exit with exit code 130 (configurable, same as posix sig int)

This PR continues previous PRs, originally at #14419 and later #15392 and #15730

Testing

Tested on ESP32, should work in other places. The changes are guarded by #if abort is enabled in the runtime -> only people who want the abort functionality will get this change.

Trade-offs and Alternatives

This code may return non-zero exit code in scenarios where previous version did return zero exit code. The exit codes are configurable and the defaults are zero, so not to introduce any breaking changes.

@RealJohnSmith
Copy link
Author

@dpgeorge can you please have a look? It is the same code as last time. Can we merge it already? Is there something that blocks it, that I should change? This drags along for half a year or so already...

@RealJohnSmith
Copy link
Author

Check commit message fails because of some other commit in the history not being signed off. This commit is OK and signed off

Copy link

github-actions bot commented Sep 17, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@RealJohnSmith
Copy link
Author

@dpgeorge, what do you think about this PR?

@RealJohnSmith
Copy link
Author

@dpgeorge ?

@RealJohnSmith
Copy link
Author

@dpgeorge Hi, do you think you could find some time to review this case? Thank you

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.57%. Comparing base (e57aa7e) to head (36f9a35).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #15863   +/-   ##
=======================================
  Coverage   98.57%   98.57%           
=======================================
  Files         169      169           
  Lines       21968    21968           
=======================================
  Hits        21654    21654           
  Misses        314      314           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RealJohnSmith RealJohnSmith force-pushed the enable-abort-support branch from 07a0994 to 36f9a35 Compare June 25, 2025 08:23
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.

1 participant