1 | <?php |
||
10 | class LinuxProcess implements ProcessInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var LoggerInterface |
||
14 | */ |
||
15 | protected $logger; |
||
16 | |||
17 | /** |
||
18 | * LinuxProcess constructor. |
||
19 | * |
||
20 | * @param LoggerInterface $logger |
||
21 | */ |
||
22 | 28 | public function __construct($logger = null) |
|
23 | { |
||
24 | 28 | if ($logger === null) { |
|
25 | 3 | $logger = new NullLogger(); |
|
26 | 3 | } |
|
27 | 28 | $this->logger = $logger; |
|
28 | 28 | } |
|
29 | |||
30 | /** |
||
31 | * Check whether a pid is running. |
||
32 | * |
||
33 | * @throws Exception\InvalidArgumentException |
||
34 | * |
||
35 | * @param int $pid |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | 18 | public function isRunning($pid) |
|
48 | |||
49 | /** |
||
50 | * Kill a process. |
||
51 | * |
||
52 | * @throws Exception\InvalidArgumentException |
||
53 | * |
||
54 | * @param int $pid |
||
55 | * @param bool $wait wait for the process to be killed |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | 15 | public function kill($pid, $wait = false) |
|
82 | } |
||
83 |