Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Lines | 5 |
Ratio | 22.73 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
37 | public function run($hostname, string $command, array $config = []) |
||
38 | { |
||
39 | $defaults = [ |
||
40 | 'timeout' => Deployer::getDefault('default_timeout', 300), |
||
41 | 'tty' => false, |
||
42 | ]; |
||
43 | $config = array_merge($defaults, $config); |
||
44 | |||
45 | $this->pop->command($hostname, $command); |
||
46 | |||
47 | View Code Duplication | if (method_exists('Process', 'fromShellCommandline')) { |
|
48 | $process = Process::fromShellCommandline($command); |
||
49 | } else { |
||
50 | $process = new Process($command); |
||
51 | } |
||
52 | $process |
||
53 | ->setTimeout($config['timeout']) |
||
54 | ->setTty($config['tty']) |
||
55 | ->mustRun($this->pop->callback($hostname)); |
||
56 | |||
57 | return $process->getOutput(); |
||
58 | } |
||
59 | } |
||
60 |