1
Fork 0

Fix executable worker arguments

This commit is contained in:
viktorstrate 2020-05-17 16:08:58 +02:00
parent 40265a18f7
commit ad7ff8d39d
2 changed files with 10 additions and 8 deletions

View File

@ -118,15 +118,15 @@ func (img *EncodeImageData) EncodeHighRes(tx *sql.Tx, outputPath string) error {
} else {
return errors.New("could not convert photo as no RAW converter was found")
}
}
} else {
image, err := img.photoImage(tx)
if err != nil {
return err
}
image, err := img.photoImage(tx)
if err != nil {
return err
EncodeImageJPEG(image, outputPath, 70)
}
EncodeImageJPEG(image, outputPath, 70)
return nil
}

View File

@ -8,6 +8,8 @@ import "fmt"
import "github.com/pkg/errors"
import "strings"
type ExecutableWorker struct {
Name string
Path string
@ -33,10 +35,10 @@ func (execWorker *ExecutableWorker) isInstalled() bool {
func (execWorker *ExecutableWorker) EncodeJpeg(inputPath string, outputPath string, jpegQuality int) error {
args := fmt.Sprintf(execWorker.argsFmt, inputPath, outputPath, jpegQuality)
cmd := exec.Command(execWorker.Path, args)
cmd := exec.Command(execWorker.Path, strings.Split(args, " ")...)
if err := cmd.Run(); err != nil {
return errors.Wrapf(err, "error encoding image using '%s'", execWorker.Name)
return errors.Wrapf(err, "error encoding image using: %s %s", execWorker.Name, args)
}
return nil