Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged branch boombatower/process-restart (PR #5456)
This PR was squashed before being merged into the master branch (closes #5456). Commits ------- be62fcc [process] provide a restart method. Discussion ---------- [process] provide a restart method. Pull request for issue #5452. Another possibility would be to allow for either run() or start() scenarios, but I am not sure that is terribly useful since restart() with a new process lends itself to restarting longer running services when they crash and you want the old process so you can inspect the logs and what not. Otherwise, something like this might work, but doesn't allow for run() to return status code. Someone can get around that by getting manually on returned process. ```php <?php public function restart($method = 'start', $callback = null) { if ($this->isRunning()) { throw new \RuntimeException('Process is already running'); } if ($method != 'start' && $method != 'run') { throw new \RuntimeException('Method must be start or run'); } $process = clone $this; $process->$method(); return $process; } ``` --------------------------------------------------------------------------- by pborreli at 2012-09-07T07:17:26Z can you add some tests please ?
- Loading branch information