mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-20 13:28:42 +00:00
fix async
This commit is contained in:
parent
a03fd72dbd
commit
4cb31cc3ed
|
|
@ -91,6 +91,7 @@ final class TesseractOcr
|
|||
self::$bin,
|
||||
$image . ' '
|
||||
. ($temp = \tempnam(\sys_get_temp_dir(), 'ocr_'))
|
||||
. ' -c preserve_interword_spaces=1'
|
||||
. ' --psm ' . $psm
|
||||
. ' --oem ' . $oem
|
||||
. ' -l ' . \implode('+', $languages)
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ final class SystemUtils
|
|||
. $cmd;
|
||||
|
||||
if ($async) {
|
||||
$cmd .= ' > nul 2>&1';
|
||||
$cmd .= ' > nul 2>&1 &';
|
||||
}
|
||||
} else {
|
||||
$cmd = \escapeshellarg($executable)
|
||||
|
|
@ -164,7 +164,7 @@ final class SystemUtils
|
|||
. $cmd;
|
||||
|
||||
if ($async) {
|
||||
$cmd .= ' > /dev/null 2>&1';
|
||||
$cmd .= ' > /dev/null 2>&1 &';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -180,8 +180,16 @@ final class SystemUtils
|
|||
throw new \Exception();
|
||||
}
|
||||
|
||||
$stdout = \stream_get_contents($pipes[1]);
|
||||
$stderr = \stream_get_contents($pipes[2]);
|
||||
$stdout = '';
|
||||
$stderr = '';
|
||||
|
||||
if ($async) {
|
||||
\stream_set_blocking($pipes[1], false);
|
||||
\stream_set_blocking($pipes[2], false);
|
||||
} else {
|
||||
$stdout = \stream_get_contents($pipes[1]);
|
||||
$stderr = \stream_get_contents($pipes[2]);
|
||||
}
|
||||
|
||||
foreach ($pipes as $pipe) {
|
||||
\fclose($pipe);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class PdfParser
|
|||
SystemUtils::runProc(
|
||||
__DIR__ . '/../../../cOMS/Tools/InvoicePreprocessing/App',
|
||||
\escapeshellarg($file) . ' '
|
||||
. \escapeshellarg($file)
|
||||
. \escapeshellarg($file)
|
||||
);
|
||||
|
||||
$ocr = new TesseractOcr();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user