Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong order of process 'exit' event and logging of unhandled exception #15

Closed
cspotcode opened this issue Jul 21, 2021 · 0 comments · Fixed by #16
Closed

Wrong order of process 'exit' event and logging of unhandled exception #15

cspotcode opened this issue Jul 21, 2021 · 0 comments · Fixed by #16

Comments

@cspotcode
Copy link
Owner

process.on('exit') event handlers should run before fatal exception is logged. However, source-map-support inverts that ordering.

process.on('exit', () => {
    console.log('exit handler');
});
throw new Error();
❯ node  ./test.js                                      
exit handler1
/d/Personal-dev/@TypeStrong/ts-node/test.js:8
throw new Error();
^

Error
    at Object.<anonymous> (/d/Personal-dev/@TypeStrong/ts-node/test.js:8:7)
...stack...
❯ node  --require source-map-support/register ./test.js

/d/Personal-dev/@TypeStrong/ts-node/test.js:8
throw new Error();
      ^
Error: 
    at Object.<anonymous> (/d/Personal-dev/@TypeStrong/ts-node/test.js:8:7)
...stack...
exit handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant