Re-enable logger after catching exit

The logger is closed during at-exit hooks that get invoked by Kernel's exit method.
This commit is contained in:
Michael Miller 2022-11-04 22:10:59 -06:00
parent 60b5f151f1
commit e2cdc9e08e
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
2 changed files with 4 additions and 0 deletions

View file

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Clear stubs defined with `expect().to receive()` syntax after test finishes to prevent leakage between tests. - Clear stubs defined with `expect().to receive()` syntax after test finishes to prevent leakage between tests.
- Ensure stubs defined with `allow().to receive()` syntax are cleared after test finishes when used inside a test (another leakage). - Ensure stubs defined with `allow().to receive()` syntax are cleared after test finishes when used inside a test (another leakage).
- Fix crash caused when logging is enabled after running an example that attempts to exit.
### Removed ### Removed
- Removed support for stubbing undefined (untyped) methods in lazy doubles. Avoids possible segfault. - Removed support for stubbing undefined (untyped) methods in lazy doubles. Avoids possible segfault.

View file

@ -20,6 +20,9 @@ class Process
# Replace the typically used exit method with a method that raises. # Replace the typically used exit method with a method that raises.
# This allows tests to catch attempts to exit the application. # This allows tests to catch attempts to exit the application.
def self.exit(status = 0) : NoReturn def self.exit(status = 0) : NoReturn
# Re-enable log that is disabled from at-exit handlers.
::Log.setup_from_env(default_level: :none)
raise ::Spectator::SystemExit.new(status: status) raise ::Spectator::SystemExit.new(status: status)
end end
end end