Skip to content

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

@cspotcode

Description

@cspotcode

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 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions