NiciusB/node-image-hash

Keeps process open after exiting

codemaster138 opened this issue · 2 comments

This package is really useful, and works great, but there's one problem:

When I use it, the process just stays open after the entire process is finished, and I have to hit CTRL+C to stop it. As soon as I replace the line where I run the hash function with just a random string, the process automatically exits, like it's supposed to.

In the documentation you mention, how the asynchronous hash function (which I am using) runs the hash in a separate node process. Is it possible there is an edge case where this auxiliary process doesn't get closed after it's done? Or do I have to close it manually and overlooked something in the README?

Minimal reproducible example:

const { hash } = require('.');

(async () => {
  const t = await hash('./test/files/castle2.png', 8, "hex");
  console.log(t);
})();

@NiciusB I have created a pull request with a fix for this issue