Symfony\Component\Process\Process::inheritEnvironmentVariables PHP Method

inheritEnvironmentVariables() public method

Sets whether environment variables will be inherited or not.
public inheritEnvironmentVariables ( boolean $inheritEnv = true ) : self
$inheritEnv boolean
return self The current Process instance
    public function inheritEnvironmentVariables($inheritEnv = true)
    {
        $this->inheritEnv = (bool) $inheritEnv;
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Creates a Process instance and returns it.
  *
  * @return Process
  *
  * @throws LogicException In case no arguments have been provided
  */
 public function getProcess()
 {
     if (0 === count($this->prefix) && 0 === count($this->arguments)) {
         throw new LogicException('You must add() command arguments before calling getProcess().');
     }
     $options = $this->options;
     $arguments = array_merge($this->prefix, $this->arguments);
     $script = implode(' ', array_map(array(__NAMESPACE__ . '\\ProcessUtils', 'escapeArgument'), $arguments));
     $process = new Process($script, $this->cwd, $this->env, $this->input, $this->timeout, $options);
     if ($this->inheritEnv) {
         $process->inheritEnvironmentVariables();
     }
     if ($this->outputDisabled) {
         $process->disableOutput();
     }
     return $process;
 }