@@ -34,7 +34,11 @@ public function process(Message $message, Context $context): Result
34
34
$ phpBin = (new PhpExecutableFinder ())->find ();
35
35
$ consoleBin = file_exists ($ this ->projectDir .'/bin/console ' ) ? './bin/console ' : './app/console ' ;
36
36
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 );
38
42
$ process ->setTimeout ($ this ->timeout );
39
43
$ process ->run ();
40
44
@@ -48,22 +52,15 @@ public function process(Message $message, Context $context): Result
48
52
}
49
53
50
54
/**
51
- * @return string
55
+ * @return string[]
52
56
*/
53
- private function getCommandLine (RunCommand $ command ): string
57
+ private function getCommandLineOptions (RunCommand $ command ): array
54
58
{
55
- $ optionsString = '' ;
59
+ $ options = [] ;
56
60
foreach ($ command ->getOptions () as $ name => $ value ) {
57
- $ optionsString . = " $ name= $ value " ;
61
+ $ options [] = "$ name= $ value " ;
58
62
}
59
- $ optionsString = trim ($ optionsString );
60
63
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 ;
68
65
}
69
66
}
0 commit comments