This commit is contained in:
drak3 2012-03-23 12:06:08 +01:00
parent af65673363
commit f9f51a5ca3

View File

@ -159,7 +159,8 @@ class Process
/**
* Starts the process and returns after sending the stdin.
* This method blocks until all stdin data is sent to the process then it returns while the pricess runs in the background.
*
* This method blocks until all stdin data is sent to the process then it returns while the process runs in the background.
* The termination of the process can be awaited with waitForTermination
*
* The callback receives the type of output (out or err) and
@ -265,7 +266,6 @@ class Process
* from the independent process during execution.
*
* @param Closure|string|array $callback
* @param boolean $invokeCallbackWithStartData
* @return int the exitcode of the process
* @throws \RuntimeException
*/
@ -282,7 +282,8 @@ class Process
if (false === $n) {
break;
} elseif ($n === 0) {
}
if (0 === $n) {
proc_terminate($this->process);
throw new \RuntimeException('The process timed out.');
@ -461,7 +462,8 @@ class Process
* Returns if the process is currently running
* @return boolean
*/
public function isRunning() {
public function isRunning()
{
if (self::STATUS_STARTED === $this->status) {
$this->updateStatus();
if($this->processInformation['running'] === false) {
@ -480,7 +482,8 @@ class Process
* @return int the exitcode of the process
* @throws \RuntimeException if the process got signaled
*/
public function stop($timeout=10) {
public function stop($timeout=10)
{
$timeoutMicro = (int) $timeout*10E6;
if ($this->isRunning()) {
proc_terminate($this->process);