photostructure / exiftool-vendored.js

Fast, cross-platform Node.js access to ExifTool
https://photostructure.github.io/exiftool-vendored.js/
MIT License
405 stars 37 forks source link

Stuck forever if perl is missing #152

Closed TdyP closed 10 months ago

TdyP commented 11 months ago

Is your feature request related to a problem? Please describe. I'm running this lib in Docker, on an Alpine container with no perl installed. When calling a simple await exiftool.version() it never responds and get stuck here forever, with no clue about what's happening. Even a try/catch doesn't caught any error. After installing perl, everything runs smoothly.

Describe the solution you'd like An explicit failure if it's not able to run a process and the reason if possible (missing perl).

Additional context I'm not sure whether this package or exiftool-vendored.pl should handle the error about missing perl, but this package should at least be able to detect it couldn't get a process running.

mceachen commented 11 months ago

I’d be happy to review a pull request to add this: but remember to only check on non-Windows, as that platform doesn’t require an external Perl environment.

mceachen commented 10 months ago
$ docker run -it node:alpine sh
/ # yarn add exiftool-vendored
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 7 new dependencies.
info Direct dependencies
└─ exiftool-vendored@22.1.0
info All dependencies
├─ @photostructure/tz-lookup@8.0.0
├─ @types/luxon@3.3.2
├─ batch-cluster@12.1.0
├─ exiftool-vendored.pl@12.65.0
├─ exiftool-vendored@22.1.0
├─ he@1.2.0
└─ luxon@3.4.2
Done in 2.29s.
/ # node
Welcome to Node.js v20.5.1.
Type ".help" for more information.
> require("exiftool-vendored").exiftool.read("/etc/hosts")
Promise {
  <pending>,
  [Symbol(async_id_symbol)]: 240,
  [Symbol(trigger_async_id_symbol)]: 6
}
> Uncaught Error: ExifTool requires perl. Please install perl and try again.