Esempio n. 1
0
 /**
  * @Given I have Supervisor running
  */
 public function iHaveSupervisorRunning()
 {
     $writer = new Writer($file = tempnam(sys_get_temp_dir(), 'supervisord_'));
     $writer->write($this->configuration);
     if ($this->supervisor->isConnected()) {
         posix_kill($this->supervisor->getPID(), SIGKILL);
     }
     $command = sprintf('(%s --configuration %s > /dev/null 2>&1 & echo $!)&', $this->bin, $file);
     exec($command, $op);
     $this->process = (int) $op[0];
     $c = 0;
     while (!$this->supervisor->isConnected() and $c < 100) {
         usleep(10000);
         $c++;
     }
     if ($c >= 100) {
         throw new \RuntimeException('Could not connect to supervisord');
     }
     if ($this->process !== $this->supervisor->getPID()) {
         throw new \RuntimeException('Connected to supervisord with a different PID');
     }
 }
 /**
  * @param Flysystem     $filesystem
  * @param string        $file
  * @param Renderer|null $renderer
  */
 public function __construct(Flysystem $filesystem, $file, Renderer $renderer = null)
 {
     $this->filesystem = $filesystem;
     parent::__construct($file, $renderer);
 }