Ejemplo n.º 1
0
 /**
  * Runs single test.
  * @param  bool
  * @return void
  */
 public function run($blocking = TRUE)
 {
     putenv('NETTE_TESTER_RUNNER=1');
     putenv('NETTE_TESTER_COLORS=' . (int) Tester\Environment::$useColors);
     $this->proc = proc_open($this->php->getCommandLine() . ' ' . escapeshellarg($this->file) . ' ' . $this->args, array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $pipes, dirname($this->file), NULL, array('bypass_shell' => TRUE));
     list($stdin, $this->stdout, $stderr) = $pipes;
     fclose($stdin);
     stream_set_blocking($this->stdout, $blocking ? 1 : 0);
     fclose($stderr);
 }
Ejemplo n.º 2
0
Archivo: Job.php Proyecto: xnovk/test
 /**
  * Runs single test.
  * @param  bool  wait till process ends
  * @return void
  */
 public function run($blocking = TRUE)
 {
     putenv(Environment::RUNNER . '=1');
     putenv(Environment::COLORS . '=' . (int) Environment::$useColors);
     $this->proc = proc_open($this->php->getCommandLine() . ' -n -d register_argc_argv=on ' . \Tester\Helpers::escapeArg($this->file) . ' ' . $this->args, array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $pipes, dirname($this->file), NULL, array('bypass_shell' => TRUE));
     list($stdin, $this->stdout, $stderr) = $pipes;
     fclose($stdin);
     fclose($stderr);
     if ($blocking) {
         while ($this->isRunning()) {
             usleep(self::RUN_USLEEP);
             // stream_select() doesn't work with proc_open()
         }
     } else {
         stream_set_blocking($this->stdout, 0);
     }
 }