Skip to content

Commit 53f181e

Browse files
author
Mathieu Lemoine
committed
Reduced dependency to voryx/Thruway
1 parent 8e44bd3 commit 53f181e

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

Diff for: RunCommandProcessor.php

+10-13
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ public function process(Message $message, Context $context): Result
3434
$phpBin = (new PhpExecutableFinder())->find();
3535
$consoleBin = file_exists($this->projectDir.'/bin/console') ? './bin/console' : './app/console';
3636

37-
$process = new Process($phpBin.' '.$consoleBin.' '.$this->getCommandLine($command), $this->projectDir);
37+
$process = new Process(array_merge(
38+
[$phpBin, $consoleBin, $command->getCommand()],
39+
$command->getArguments(),
40+
$this->getCommandLineOptions($command)
41+
), $this->projectDir);
3842
$process->setTimeout($this->timeout);
3943
$process->run();
4044

@@ -48,22 +52,15 @@ public function process(Message $message, Context $context): Result
4852
}
4953

5054
/**
51-
* @return string
55+
* @return string[]
5256
*/
53-
private function getCommandLine(RunCommand $command): string
57+
private function getCommandLineOptions(RunCommand $command): array
5458
{
55-
$optionsString = '';
59+
$options = [];
5660
foreach ($command->getOptions() as $name => $value) {
57-
$optionsString .= " $name=$value";
61+
$options[] = "$name=$value";
5862
}
59-
$optionsString = trim($optionsString);
6063

61-
$argumentsString = '';
62-
foreach ($command->getArguments() as $value) {
63-
$argumentsString .= " $value";
64-
}
65-
$argumentsString = trim($argumentsString);
66-
67-
return trim($command->getCommand().' '.$argumentsString.' '.$optionsString);
64+
return $options;
6865
}
6966
}

Diff for: composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"symfony/process": "^3.4|^4|^5"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "~5.5",
16+
"phpunit/phpunit": "~7.5",
1717
"symfony/dependency-injection": "^3.4|^4|^5",
1818
"symfony/config": "^3.4|^4|^5",
1919
"symfony/http-kernel": "^3.4|^4|^5",
2020
"symfony/filesystem": "^3.4|^4|^5",
21+
"symfony/yaml": "^3.4|^4|^5",
2122
"enqueue/null": "0.9.x-dev",
2223
"enqueue/fs": "0.9.x-dev",
2324
"enqueue/test": "0.9.x-dev"

0 commit comments

Comments
 (0)