Improve messages in case of system exit. This prints a better set of error messages in case someone calls `os._exit()` or in C code `exit()` is used.

Resolves #3486.

- [x] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry

package:
  name: sharedlib-test-py
  version: "1.0"
  _tag: pyodide.test
  top-level:
    - sharedlib_test
requirements:
  run:
    - sharedlib-test
  host:
    - sharedlib-test
source:
  path: src
build:
  cross-script: |
    pwd
    echo PYTHONPATH: $PYTHONPATH
    echo _PYTHON_HOST_PLATFORM: $_PYTHON_HOST_PLATFORM
  cflags: |
    -I$(PYODIDE_ROOT)/packages/sharedlib-test/src/include
  ldflags: |
    $(PYODIDE_ROOT)/packages/sharedlib-test/build/sharedlib-test-1.0/dist/sharedlib-test.so

package:
  name: sharedlib-test-py
  version: "1.0"
  _tag: pyodide.test
  top-level:
    - sharedlib_test
requirements:
  run:
    - sharedlib-test
  host:
    - sharedlib-test
source:
  path: src
build:
  cross-script: |
    pwd
    echo PYTHONPATH: $PYTHONPATH
    echo _PYTHON_HOST_PLATFORM: $_PYTHON_HOST_PLATFORM
  cflags: |
    -I$(PYODIDE_ROOT)/packages/sharedlib-test/src/include
  ldflags: |
    $(PYODIDE_ROOT)/packages/sharedlib-test/build/sharedlib-test-1.0/dist/sharedlib-test.so
