diff --git a/app/SearchDisplace/Convertor/Convertor.php b/app/SearchDisplace/Convertor/Convertor.php index 863bd13..9096e6c 100644 --- a/app/SearchDisplace/Convertor/Convertor.php +++ b/app/SearchDisplace/Convertor/Convertor.php @@ -44,6 +44,8 @@ class Convertor { Log::info( 'COMMAND: ' . 'soffice ' . + '--headless ' . + '--safe-mode ' . '--convert-to ' . $to . ' ' . $original . ' ' . @@ -55,22 +57,23 @@ class Convertor { # The "OpenDocument Text Flat XML" parameter contains whitespaces, so we will need to add that as # a env variable parameter, otherwise the Process class will escape it and it will not work properly. $process = Process::fromShellCommandline( - "soffice --convert-to $to $original --outdir $folder", - null, //base_path(), + "soffice --quickstart=no --headless --safe-mode --convert-to $to $original --outdir $folder", + null, $env ); - $process->run(function ($type, $buffer) { + + $process->start(function ($type, $buffer) { if (Process::ERR === $type) { Log::info("CONVERT ERROR: " . $buffer); } }, $env); + $process->wait(); + if (!$process->isSuccessful()) { throw new ProcessFailedException($process); } - Storage::deleteDirectory(env('LIBREOFFICE_CONFIG_PATH', 'app/tmp/libreoffice')); - return $path['filename'] . '.' . $to; } } \ No newline at end of file