/**
  * @param PreExecuteEvent $event
  *
  * @throws \Exception
  */
 public function onPreExecute(PreExecuteEvent $event)
 {
     $process = $event->getProcess();
     foreach ($this->environmentVariableRepository->getEnvironmentVariables() as $row) {
         list($key, $value) = explode('=', $row);
         $process->setEnv([$key => $value]);
     }
 }
 /**
  * @param Event\PreExecuteEvent $event
  *
  * @throws \Exception
  */
 public function onPreExecute(Event\PreExecuteEvent $event)
 {
     $task = $event->getTask();
     if (!$task instanceof AbstractTask || !$task instanceof ExecuteTask) {
         return;
     }
     if (!$task->hasParameter('remote')) {
         return;
     }
     $event->stopPropagation();
     $remote = $task->getParameter('remote');
     if (!isset($this->hosts[$remote])) {
         throw new \Exception(sprintf("The given host (%s) doesn't exist. Must be one of: %s", $remote, implode(array_keys($this->hosts))));
     }
     $ssh = $this->createSSHHandler($this->hosts[$remote]);
     $output = $ssh->exec($event->getProcessBuilder()->getProcess()->getCommandLine());
     if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_VERY_VERBOSE) {
         $this->output->writeln(["<comment>------Remote------</comment>", $output, "<comment>-----/Remote------</comment>"]);
     }
 }