Passed
Push — master ( d5c5e0...724c44 )
by Allan
02:09
created

SystemUtils::getCommandStdOut()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 2
nc 3
nop 3
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerChangelogs\Utils;
7
8
class SystemUtils
9
{
10
    public function getCommandStdOut($command, $cwd, $default = '')
11
    {
12
        $process = new \Symfony\Component\Process\Process($command, $cwd);
13
14
        $process->setTimeout(null);
15
16
        try {
17
            $process->mustRun();
18
19
            return $process->getOutput();
20
        } catch (\Symfony\Component\Process\Exception\ProcessFailedException $exception) {
21
            return $default;
22
        }
23
    }
24
}
25