Passed
Push — master ( 1be2c9...3b7d80 )
by Nils
02:34
created

Runner::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Startwind\Inventorio\Exec;
4
5
use Symfony\Component\Process\Process;
6
7
abstract class Runner
8
{
9
    public static function run($command, $killAfterSeconds = 5): Process
10
    {
11
        $shellCommandLine = "timeout --kill-after=" . $killAfterSeconds . "s 1m " . $command;
12
13
        $process = Process::fromShellCommandline($shellCommandLine);
14
15
        $process->run();
16
17
        return $process;
18
    }
19
}