@@ -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 /**
0 commit comments