I think the problem might be a race between the the process exiting and the exit listener being installed. Ideally, the exit listener should be installed in the same tick as the child_process.spawn, then this could never happen.
I'm basically doing (for a lot of files):
const etp = new exiftool.ExiftoolProcess(exiftoolBin);
await etp.open();
const metadata = await etp.readMetadata(filename); // This hangs if exiftool process is killed
and on the terminal:
taskkill /F /IM exiftool.exe
I do realize now that I don't actually need to spawn a new process for each image, so I'll see if I can work around it that way. This is still worth fixing though...
I think the problem might be a race between the the process exiting and the exit listener being installed. Ideally, the exit listener should be installed in the same tick as the
child_process.spawn
, then this could never happen.I'm basically doing (for a lot of files):
and on the terminal:
I do realize now that I don't actually need to spawn a new process for each image, so I'll see if I can work around it that way. This is still worth fixing though...