hardExit method

void hardExit(
  1. int exitCode
)

Terminate the process immediately with exitCode, skipping atexit handlers and C++ static destructors. Does not return, unless running against a pre-1.9.0 libdart_bridge, where it is a no-op and the caller must fall back to dart:io's exit().

dart:io's exit() runs the normal C teardown, which destroys the C++ statics inside every loaded CPython extension module. The interpreter lives on a detached thread that may still be running, so that teardown can fault it. Use this instead wherever the process is going away anyway.

Implementation

void hardExit(int exitCode) => _hardExit?.call(exitCode);