@@ -277,7 +277,13 @@ private function awaitForAllProcesses()
277
277
{
278
278
while ($ this ->inProgress && $ this ->checkTimeout ()) {
279
279
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 ) {
281
287
unset($ this ->inProgress [$ name ]);
282
288
}
283
289
}
@@ -351,22 +357,27 @@ function () use ($package) {
351
357
352
358
// process child process
353
359
$ this ->inProgress = [];
354
- $ this ->deployPackageService ->deploy ($ package , $ this ->options , true );
360
+ $ isDeployed = $ this ->deployPackageService ->deploy ($ package , $ this ->options , true );
355
361
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
356
- exit (0 );
362
+ exit (( int )! $ isDeployed );
357
363
} 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 ;
360
371
}
361
372
}
362
373
363
374
/**
364
375
* Checks if package is deployed.
365
376
*
366
377
* @param Package $package
367
- * @return bool
378
+ * @return null| bool
368
379
*/
369
- private function isDeployed (Package $ package )
380
+ private function isDeployed (Package $ package ): ? bool
370
381
{
371
382
if ($ this ->isCanBeParalleled ()) {
372
383
if ($ package ->getState () === null ) {
@@ -375,7 +386,7 @@ private function isDeployed(Package $package)
375
386
// When $pid comes back as null the child process for this package has not yet started; prevents both
376
387
// hanging until timeout expires (which was behaviour in 2.2.x) and the type error from strict_types
377
388
if ($ pid === null ) {
378
- return false ;
389
+ return null ;
379
390
}
380
391
381
392
// phpcs:ignore Magento2.Functions.DiscouragedFunction
@@ -406,10 +417,10 @@ private function isDeployed(Package $package)
406
417
"Error encountered checking child process status (PID: $ pid): $ strerror (errno: $ errno) "
407
418
);
408
419
}
409
- return false ;
420
+ return null ;
410
421
}
411
422
}
412
- return $ package ->getState ();
423
+ return ( bool ) $ package ->getState ();
413
424
}
414
425
415
426
/**
0 commit comments