From caec48a374d9de8a1505d5b8997fea8bfc72745c Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Tue, 15 Dec 2020 16:42:26 +1300 Subject: Only mark process as finished after fully sending the output (#16952) Otherwise there could be a race condition in cli multi where it thinks the process is finished, but the output hasn't been sent and written yet. Thus ending up with an "empty response" error under circumstances or only reading a partial output. This should only affect Matomo for WordPress though --- core/CliMulti/RequestCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/CliMulti/RequestCommand.php b/core/CliMulti/RequestCommand.php index 49c521f31f..f2e07dcb94 100644 --- a/core/CliMulti/RequestCommand.php +++ b/core/CliMulti/RequestCommand.php @@ -78,13 +78,13 @@ class RequestCommand extends ConsoleCommand require_once PIWIK_INCLUDE_PATH . $indexFile; - if (!empty($process)) { - $process->finishProcess(); - } - while (ob_get_level()) { echo ob_get_clean(); } + + if (!empty($process)) { + $process->finishProcess(); + } } private function isTestModeEnabled() -- cgit v1.2.3