예제 #1
0
 public function testIsRunning()
 {
     if (!$this->object->isAvailable()) {
         $this->markTestSkipped();
     }
     $pid = $this->startProcess();
     $this->assertTrue($this->object->isRunning($pid));
     fwrite($this->pipes[0], PHP_EOL);
     $exitCode = $this->endProcess();
     $this->assertEquals(0, $exitCode);
     $this->assertFalse($this->object->isRunning($pid));
 }
예제 #2
0
 /** Check if there is a running daemon
  *
  * @return int|null
  */
 protected function getRunningPid()
 {
     if (!file_exists($this->pidFilePath)) {
         return;
     }
     $pid = intval(trim(file_get_contents($this->pidFilePath)));
     if ($this->processControl->isRunning($pid, true)) {
         return $pid;
     }
     // Not found, remove the stale PID file
     unlink($this->pidFilePath);
 }