Closed fdcastel closed 7 years ago
The example in the readme is copied directly from mysql2 and only adapted to use TypeScript, but I can provide an explanation nonetheless:
NodeJS only exits the process if there are no more events in the event loop and there are no more open streams, unless you unref
them. Typically Node is used for web applications that are supposed to run until terminated. So yes, this is expected.
This code (from README, using non-promises version) hangs after displaying
The solution is: 2
I had to add a
to the end of file to fix this. Then the program finishes normally.
Is this the expected behavior?
Using
mysql2
version1.2.0
.Node.js
versionv6.10.3
.