Skip to content

Commit

Permalink
fix #168
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Jan 17, 2024
1 parent 1fa73e4 commit 1824698
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ExifToolTask.ts
Expand Up @@ -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<T> extends bc.Task<T> {
static renderCommand(args: string[]): string {
return [...args, "-ignoreMinorErrors", "-execute", ""].join("\n")
Expand All @@ -17,6 +19,17 @@ export abstract class ExifToolTask<T> extends bc.Task<T> {
)
}

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<Error>
if (notBlank(stderr) || !passed) {
Expand Down

0 comments on commit 1824698

Please sign in to comment.