Skip to content

Commit 7154e3a

Browse files
oshmyheliukshiftedreality
authored andcommitted
MAGECLOUD-4849: Not full error log on failed execution of shell command (magento#654)
1 parent 2d48eac commit 7154e3a

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

src/Shell/Process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function execute()
3838
$error = sprintf(
3939
'The command "%s" failed. %s',
4040
$process->getCommandLine(),
41-
trim($process->getErrorOutput(), "\n")
41+
trim($process->getErrorOutput() ?: $process->getOutput(), "\n")
4242
);
4343

4444
throw new ProcessException($error, $process->getExitCode());

src/Step/PostDeploy/TimeToFirstByte.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\MagentoCloud\Step\PostDeploy;
99

10+
use GuzzleHttp\Promise\PromiseInterface;
1011
use GuzzleHttp\RequestOptions;
1112
use Magento\MagentoCloud\Config\Stage\PostDeployInterface;
1213
use Magento\MagentoCloud\Http\PoolFactory;
@@ -82,7 +83,9 @@ public function execute()
8283
'concurrency' => 1,
8384
]);
8485

85-
$pool->promise()->wait();
86+
/** @var PromiseInterface $promise */
87+
$promise = $pool->promise();
88+
$promise->wait();
8689
} catch (\Throwable $exception) {
8790
throw new StepException($exception->getMessage(), $exception->getCode(), $exception);
8891
}

src/Step/PostDeploy/WarmUp.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\MagentoCloud\Step\PostDeploy;
99

1010
use GuzzleHttp\Exception\RequestException;
11+
use GuzzleHttp\Promise\PromiseInterface;
1112
use Magento\MagentoCloud\Http\PoolFactory;
1213
use Magento\MagentoCloud\WarmUp\Urls;
1314
use Magento\MagentoCloud\Step\StepException;
@@ -85,7 +86,9 @@ public function execute()
8586
try {
8687
$pool = $this->poolFactory->create($urls, compact('fulfilled', 'rejected'));
8788

88-
$pool->promise()->wait();
89+
/** @var PromiseInterface $promise */
90+
$promise = $pool->promise();
91+
$promise->wait();
8992
} catch (\Throwable $exception) {
9093
throw new StepException($exception->getMessage(), $exception->getCode(), $exception);
9194
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\MagentoCloud\Test\Functional\Acceptance;
9+
10+
use CliTester;
11+
use Magento\MagentoCloud\Test\Functional\Codeception\Docker;
12+
13+
/**
14+
* This test runs on the latest version of PHP
15+
*/
16+
class ErrorMessageCest extends AbstractCest
17+
{
18+
/**
19+
* @param CliTester $I
20+
* @throws \Robo\Exception\TaskException
21+
*/
22+
public function _before(CliTester $I)
23+
{
24+
parent::_before($I);
25+
$I->cloneTemplate();
26+
$I->addEceComposerRepo();
27+
}
28+
29+
/**
30+
* @param CliTester $I
31+
* @throws \Robo\Exception\TaskException
32+
*/
33+
public function testShellErrorMessage(CliTester $I)
34+
{
35+
$I->cleanDirectories(['/bin/*']);
36+
$I->assertFalse($I->runEceToolsCommand('build', Docker::BUILD_CONTAINER));
37+
$I->seeInOutput('Could not open input file: ./bin/magento');
38+
}
39+
}

0 commit comments

Comments
 (0)