summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bookpipeline/main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/bookpipeline/main.go b/cmd/bookpipeline/main.go
index aa6853f..0d310f1 100644
--- a/cmd/bookpipeline/main.go
+++ b/cmd/bookpipeline/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "bytes"
"errors"
"flag"
"fmt"
@@ -171,12 +172,15 @@ func ocr(training string) func(chan string, chan string, chan error, *log.Logger
logger.Println("OCRing", path)
name := strings.Replace(path, ".png", "", 1)
cmd := exec.Command("tesseract", "-l", training, path, name, "hocr")
+ var stdout, stderr bytes.Buffer
+ cmd.Stdout = &stdout
+ cmd.Stderr = &stderr
err := cmd.Run()
if err != nil {
for range toocr {
} // consume the rest of the receiving channel so it isn't blocked
close(up)
- errc <- errors.New(fmt.Sprintf("Error ocring %s: %s", path, err))
+ errc <- errors.New(fmt.Sprintf("Error ocring %s: %s\nStdout: %s\nStderr: %s\n", path, err, stdout.String(), stderr.String()))
return
}
up <- name + ".hocr"