Created
February 20, 2019 01:06
-
-
Save tbranyen/c74f7ca6678d1739eeccbdd61210c322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makePromise() { | |
return new Promise(() => {}); | |
} | |
async function main() { | |
console.log('start'); | |
await makePromise(); | |
console.log('end'); | |
} | |
main(); |
Issue described in Node's issue tracker: nodejs/node#22088
As far as I know, as soon as that event loop is cleared that's the end of the process.
Because nothing is going to ever run after the promise is fulfilled there is nothing in the event loop to be done.
Oh my god, I'm pretty sure I ran into this for the first time a couple weeks ago! Thought I was going crazy, but like always my assumptions were just wrong. Thanks for giving me my sanity back.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why does Node log
start
and exit immediately? Shouldn't it keep the process alive, waiting for the promise to resolve (which it never will)?