const exitHook = require('async-exit-hook'); exitHook(() => { console.log('exiting'); }); // you can add multiple hooks, even across files exitHook(() => { console.log('exiting 2'); }); // you can add async hooks by accepting a callback exitHook(callback => { setTime...
but on the main thread rather than a Worker thread. test: regression tests for async_hooks + Promise + Worker interaction Add regression tests for the case in which an async_hook is enabled inside a Worker thread andprocess.exit()is called during the async part of an async function. This ...