Ejemplo n.º 1
0
 /**
  * Creates a Process instance
  *
  * @return Process
  *
  * @throws MethodCallException When arguments are not present
  */
 public function getProcess() : Process
 {
     if (count($this->prefix) === 0 && count($this->arguments) === 0) {
         throw new MethodCallException('You must add arguments before calling getProcess()');
     }
     $arguments = array_merge($this->prefix, $this->arguments);
     $command = implode(' ', array_map('escapeshellarg', $arguments));
     if ($this->inheritEnv) {
         $env = array_replace($_SERVER, $this->environment);
     } else {
         $env = $this->environment;
     }
     $process = new Process($command, $this->directory, $env, $this->input, $this->timeout, $this->stdout, $this->stderr);
     if ($this->outputDisabled) {
         $process->disableOutput();
     }
     return $process;
 }
Ejemplo n.º 2
0
 public function test_that_is_output_disabled_returns_true_when_disabled()
 {
     $process = new Process('ls -la');
     $process->disableOutput();
     $this->assertTrue($process->isOutputDisabled());
 }