Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
19 | 2 | public function run(Directory $workingDirectory, Argument ...$arguments): Result |
|
20 | { |
||
21 | $descriptorSpec = [ |
||
22 | 2 | ['pipe', 'r'], |
|
23 | ['pipe', 'w'], |
||
24 | ['pipe', 'w'], |
||
25 | ]; |
||
26 | |||
27 | 2 | $process = proc_open($this->buildCommand(...$arguments), $descriptorSpec, $pipes, $workingDirectory->getPath()); |
|
28 | |||
29 | 2 | $stdOut = stream_get_contents($pipes[1]); |
|
30 | 2 | $stdErr = stream_get_contents($pipes[2]); |
|
31 | |||
32 | 2 | foreach ($pipes as $pipe) { |
|
33 | 2 | fclose($pipe); |
|
34 | } |
||
35 | |||
36 | 2 | return new Result(proc_close($process), $stdOut, $stdErr); |
|
37 | } |
||
38 | |||
50 |