From 0c1b319bc0164545efc2ff07b025e28605b4aa28 Mon Sep 17 00:00:00 2001 From: Radu Liviu Carjan Date: Mon, 31 Oct 2022 18:25:11 +0200 Subject: [PATCH] Minor updates to the convertor --- app/SearchDisplace/Convertor/Convertor.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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