Files
Kmake/test/fixtures/process/unregister.mjs
2026-05-26 23:36:42 -07:00

22 lines
445 B
JavaScript

import { strictEqual } from 'assert'
function setup() {
const obj = { foo: 'bar' }
process.finalization.register(obj, shutdown)
setImmediate(function () {
process.finalization.unregister(obj)
process.finalization.unregister(obj) // twice, this should not throw
})
}
let shutdownCalled = false
function shutdown(obj) {
shutdownCalled = true
}
setup()
process.on('exit', function () {
strictEqual(shutdownCalled, false)
})