Skip to content

Commit d4f83c8

Browse files
committed
MC-42026: [Cloud] Custom theme is not applied and the default LUMA theme is used.
1 parent 28bedc7 commit d4f83c8

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

app/code/Magento/Deploy/Process/Queue.php

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,13 @@ private function awaitForAllProcesses()
277277
{
278278
while ($this->inProgress && $this->checkTimeout()) {
279279
foreach ($this->inProgress as $name => $package) {
280-
if ($this->isDeployed($package)) {
280+
$isDeployed = $this->isDeployed($package);
281+
282+
if ($isDeployed === false) {
283+
throw new \RuntimeException(
284+
"Deploy of the package " . $package->getPath() . " has failed."
285+
);
286+
} elseif ($isDeployed) {
281287
unset($this->inProgress[$name]);
282288
}
283289
}
@@ -351,22 +357,27 @@ function () use ($package) {
351357

352358
// process child process
353359
$this->inProgress = [];
354-
$this->deployPackageService->deploy($package, $this->options, true);
360+
$isDeployed = $this->deployPackageService->deploy($package, $this->options, true);
355361
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
356-
exit(0);
362+
exit((int)!$isDeployed);
357363
} else {
358-
$this->deployPackageService->deploy($package, $this->options);
359-
return true;
364+
$isDeployed = $this->deployPackageService->deploy($package, $this->options);
365+
if ($isDeployed === false) {
366+
throw new \RuntimeException(
367+
"Deploy of the package " . $package->getPath() . " has failed."
368+
);
369+
}
370+
return $isDeployed;
360371
}
361372
}
362373

363374
/**
364375
* Checks if package is deployed.
365376
*
366377
* @param Package $package
367-
* @return bool
378+
* @return null|bool
368379
*/
369-
private function isDeployed(Package $package)
380+
private function isDeployed(Package $package): ?bool
370381
{
371382
if ($this->isCanBeParalleled()) {
372383
if ($package->getState() === null) {
@@ -375,7 +386,7 @@ private function isDeployed(Package $package)
375386
// When $pid comes back as null the child process for this package has not yet started; prevents both
376387
// hanging until timeout expires (which was behaviour in 2.2.x) and the type error from strict_types
377388
if ($pid === null) {
378-
return false;
389+
return null;
379390
}
380391

381392
// phpcs:ignore Magento2.Functions.DiscouragedFunction
@@ -406,10 +417,10 @@ private function isDeployed(Package $package)
406417
"Error encountered checking child process status (PID: $pid): $strerror (errno: $errno)"
407418
);
408419
}
409-
return false;
420+
return null;
410421
}
411422
}
412-
return $package->getState();
423+
return (bool)$package->getState();
413424
}
414425

415426
/**

app/code/Magento/Deploy/Service/DeployPackage.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ public function deploy(Package $package, array $options, $skipLogging = false)
9999
function () use ($package, $options, $skipLogging) {
100100
// emulate application locale needed for correct file path resolving
101101
$this->localeResolver->setLocale($package->getLocale());
102-
$this->deployEmulated($package, $options, $skipLogging);
102+
/**
103+
* \Magento\Framework\App\State::emulateAreaCode was returning the result of this
104+
* anonymous function, and the result wasn't provided
105+
*/
106+
return $this->deployEmulated($package, $options, $skipLogging);
103107
}
104108
);
105109
$package->setState(Package::STATE_COMPLETED);
@@ -150,8 +154,8 @@ public function deployEmulated(Package $package, array $options, $skipLogging =
150154
foreach ($package->getPostProcessors() as $processor) {
151155
$processor->process($package, $options);
152156
}
153-
154-
return true;
157+
// $this->errorsCount was counted but never checked in the end. Return was always true.
158+
return !(bool)$this->errorsCount;
155159
}
156160

157161
/**

0 commit comments

Comments
 (0)