fix #3: error out only when stdout is empty

When executing tesseract, sometimes we get the correct output on stdout
and an error on stderr, in that case we simply use the stdout and
discard the error. Bump to version 0.3.8.
This commit is contained in:
kaffarell 2023-08-14 18:05:03 +02:00
parent 548c545f77
commit d65f48ac9d
4 changed files with 6 additions and 4 deletions

View file

@ -1,7 +1,7 @@
{
"id": "image-ocr",
"name": "Image OCR",
"version": "0.3.7",
"version": "0.3.8",
"minAppVersion": "0.15.0",
"description": "Runs OCR on images and copies content in image caption.",
"author": "kaffarell",

View file

@ -1,6 +1,6 @@
{
"name": "image-ocr",
"version": "0.3.7",
"version": "0.3.8",
"description": "Runs ocr on pasted images and posts result in details box. This allows to search in images.",
"main": "dist/main.js",
"scripts": {

View file

@ -174,7 +174,8 @@ export default class TesseractOcrPlugin extends Plugin {
execution.on('close', () => {
if (this.settings.debug == true) console.log('tesseract output: ' + stdout.join(''));
if (this.settings.debug == true) console.log('tesseract output: ' + error.join(''));
if (error.length) reject(error.join(''));
// if we don't get any output, reject
if (stdout.join('').length == 0) reject(error.join(''));
else resolve(stdout.join(''));
});

View file

@ -8,5 +8,6 @@
"0.3.4": "0.15.0",
"0.3.5": "0.15.0",
"0.3.6": "0.15.0",
"0.3.7": "0.15.0"
"0.3.7": "0.15.0",
"0.3.8": "0.15.0"
}