Skip to content

Commit ac535cd

Browse files
authored
Merge pull request #28 from articstudio/develop
Fix process timeout
2 parents 1434b8e + dbd496b commit ac535cd

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [1.0.7] - 2019-02-22
5+
6+
### Fixed
7+
8+
- Fix process timeout
9+
410
## [1.0.6] - 2019-02-07
511

612
### Fixed
@@ -46,6 +52,7 @@ All notable changes to this project will be documented in this file.
4652
- PHP
4753

4854

55+
[1.0.7]: https://github.com/articstudio/php-bin/releases/tag/1.0.7
4956
[1.0.6]: https://github.com/articstudio/php-bin/releases/tag/1.0.6
5057
[1.0.5]: https://github.com/articstudio/php-bin/releases/tag/1.0.5
5158
[1.0.4]: https://github.com/articstudio/php-bin/releases/tag/1.0.4

src/Commands/Composer/Install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private function requireDevPackage($version, $input_package_name)
8585
if (! $version) {
8686
try {
8787
$command = 'composer require --dev ' . $input_package_name;
88-
list($exit_code, $output, $exit_code_txt, $error) = $this->callShell($command, false);
88+
list($exit_code, $output, $exit_code_txt, $error) = $this->callShell($command, false, 240);
8989
if ($exit_code === 1) {
9090
throw new PhpBinException("Error installing package: " . $input_package_name . " " . $error);
9191
}

src/Concerns/HasShell.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ trait HasShell
1212
* Call shell command
1313
*
1414
* @param string $cmd
15+
* @param bool $throw
16+
* @param int $timeout
1517
* @return array
1618
* @throws ProcessFailedException
1719
*/
18-
protected function callShell(string $cmd, bool $throw = true): array
20+
protected function callShell(string $cmd, bool $throw = true, $timeout = 60): array
1921
{
2022
$composer = Application::getInstance()->getComposer();
2123
$cmd = "cd {$composer['directory']} && " . $cmd;
2224
$process = new Process($cmd);
25+
$process->setTimeout($timeout);
2326
$process->run();
2427
//while ($process->isRunning()) {
2528
// TODO: Show loading spinner

0 commit comments

Comments
 (0)