1 | <?php |
||
10 | class ParallelProcess implements Runnable |
||
11 | { |
||
12 | protected $process; |
||
13 | protected $id; |
||
14 | protected $pid; |
||
15 | |||
16 | protected $output; |
||
17 | protected $errorOutput; |
||
18 | |||
19 | protected $startTime; |
||
20 | |||
21 | use ProcessCallbacks; |
||
22 | |||
23 | public function __construct(Process $process, int $id) |
||
28 | |||
29 | public static function create(Process $process, int $id): self |
||
33 | |||
34 | public function start(): self |
||
44 | |||
45 | public function stop($timeout = 0): self |
||
46 | { |
||
47 | $this->process->stop($timeout, SIGKILL); |
||
48 | |||
49 | return $this; |
||
50 | } |
||
51 | |||
52 | public function isRunning(): bool |
||
56 | |||
57 | public function isSuccessful(): bool |
||
61 | |||
62 | public function isTerminated(): bool |
||
66 | |||
67 | public function getOutput() |
||
81 | |||
82 | public function getErrorOutput() |
||
96 | |||
97 | public function getProcess(): Process |
||
101 | |||
102 | public function getId(): int |
||
106 | |||
107 | public function getPid(): ?int |
||
111 | |||
112 | public function getCurrentExecutionTime(): float |
||
116 | |||
117 | protected function resolveErrorOutput(): Throwable |
||
131 | } |
||
132 |