public function isProcessFinished()
{
if (null === $this->process) {
throw new \LogicException('Process not started');
}
if ($this->process->isTerminated()) {
call_user_func($this->onFinish);
$this->process = null;
$this->onFinish = null;
return true;
}
return false;
}