Esempio n. 1
0
 /**
  * Executes the given command via shell and returns the complete output as
  * a string
  *
  * @param string $command
  *
  * @return array(status, stdout, stderr)
  */
 protected function executeCommand($command)
 {
     if (class_exists('Symfony\\Component\\Process\\Process')) {
         $process = new \Symfony\Component\Process\Process($command, NULL, $this->env);
         if ($this->timeout !== false) {
             $process->setTimeout($this->timeout);
         }
     } else {
         $process = new Process($command, $this->env);
     }
     $process->run();
     return array($process->getExitCode(), $process->getOutput(), $process->getErrorOutput());
 }
Esempio n. 2
0
 /**
  * @test
  **/
 public function it_should_use_inherited_environment_variables_for_process()
 {
     $process = new Process('echo $PATH');
     $process->run();
     $this->assertNotEquals("/\n", $process->getOutput(), 'PATH env should not be modified');
 }