From 18246980b9daaeb20f6f5eea5131c5d5cfb3868e Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Tue, 16 Jan 2024 20:55:06 -0800 Subject: [PATCH] fix #168 --- src/ExifToolTask.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ExifToolTask.ts b/src/ExifToolTask.ts index 739bb75b..3a819d53 100644 --- a/src/ExifToolTask.ts +++ b/src/ExifToolTask.ts @@ -3,6 +3,8 @@ import { isWarning } from "./IsWarning" import { Maybe } from "./Maybe" import { notBlank, splitLines } from "./String" +const BadPerlInstallationRE = /Can't locate \S+ in @INC/i + export abstract class ExifToolTask extends bc.Task { static renderCommand(args: string[]): string { return [...args, "-ignoreMinorErrors", "-execute", ""].join("\n") @@ -17,6 +19,17 @@ export abstract class ExifToolTask extends bc.Task { ) } + override onStderr(buf: string | Buffer): void { + if (BadPerlInstallationRE.test(buf.toString())) { + // This isn't an error we can recover from: there's a Perl module that + // needs to be installed. See + // https://github.com/photostructure/exiftool-vendored.js/issues/168 for + // details. + throw new Error(buf.toString()) + } + super.onStderr(buf) + } + #parser(stdout: string, stderr: string | undefined, passed: boolean): T { let error: Maybe if (notBlank(stderr) || !passed) {