当前位置: 首页>>代码示例>>PHP>>正文


PHP ProcessBuilder::addEnvironmentVariables方法代码示例

本文整理汇总了PHP中Symfony\Component\Process\ProcessBuilder::addEnvironmentVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP ProcessBuilder::addEnvironmentVariables方法的具体用法?PHP ProcessBuilder::addEnvironmentVariables怎么用?PHP ProcessBuilder::addEnvironmentVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Process\ProcessBuilder的用法示例。


在下文中一共展示了ProcessBuilder::addEnvironmentVariables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createProcessBuilder

 /**
  * Create process builder object
  *
  * @param array $arguments
  *
  * @return ProcessBuilder
  */
 protected function createProcessBuilder(array $arguments = [])
 {
     $processBuilder = new ProcessBuilder($arguments);
     $processBuilder->setPrefix($this->getOption('bin', self::DEFAULT_BINARY));
     $processBuilder->addEnvironmentVariables($this->getOption('env', []));
     return $processBuilder;
 }
开发者ID:etd-framework,项目名称:Ghostscript,代码行数:14,代码来源:Ghostscript.php

示例2: _reconfigure

 /**
  * {@inheritDoc}
  *
  * Starts the connection
  */
 public function _reconfigure($config = array())
 {
     parent::_reconfigure($config);
     if (!isset($this->config['username'])) {
         throw new \Exception("Sauce Connect Extension requires a username.");
     }
     if (!isset($this->config['accesskey'])) {
         throw new \Exception("Sauce Connect Extension requires a accesskey.");
     }
     $connect = __DIR__ . '/../../../bin/sauce_connect';
     if (!file_exists($connect)) {
         $connect = __DIR__ . '/../../../../bin/sauce_connect';
     }
     if (!file_exists($connect)) {
         throw new \Exception("Couldnt find the bin directory... Make sure its in ./bin or ./vendor/bin/");
     }
     $processBuilder = new ProcessBuilder([$connect]);
     $processBuilder->addEnvironmentVariables(['SAUCE_USERNAME' => $this->config['username'], 'SAUCE_ACCESS_KEY' => $this->config['accesskey']]);
     $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 60;
     $this->process = $processBuilder->getProcess();
     $this->process->setTimeout(0);
     $this->process->start(function ($type, $buffer) {
         $buffer = explode("\n", $buffer);
         foreach ($buffer as $line) {
             if (strpos($line, 'Press any key to see more output') === false) {
                 file_put_contents(codecept_output_dir() . 'sauce_connect.log', $line . "\n", FILE_APPEND);
             }
         }
     });
     $timer = 0;
     $connected = false;
     $this->writeln(["", "----------------------------------------------------------------------------", "Attempting to connect to SauceLabs. Waiting {$timeout} seconds."]);
     while ($this->process->isRunning() && $timer < $timeout) {
         $output = $this->process->getOutput();
         if (strpos($output, 'Connected! You may start your tests.') !== false) {
             $connected = true;
             break;
         }
         sleep(1);
         $timer++;
         if ($timer % 5 === 0) {
             $this->write('.');
         }
     }
     if (false === $connected) {
         $this->process->stop();
         throw new \Exception(sprintf("Could not start tunnel. Check %ssauce_connect.log for more information.", codecept_output_dir()));
     }
     $this->writeln(["", "Connected to SauceLabs", "----------------------------------------------------------------------------", ""]);
 }
开发者ID:lfgamers,项目名称:sauce-connect-extension,代码行数:55,代码来源:SauceConnectExtension.php

示例3: addEnvironmentVariables

 /**
  * Adds a set of environment variables.
  *
  * Already existing environment variables with the same name will be
  * overridden by the new values passed to this method. Pass `null` to unset
  * a variable.
  *
  * @param array $variables The variables
  *
  * @return ProcessBuilderProxyInterface
  */
 public function addEnvironmentVariables(array $variables) : ProcessBuilderProxyInterface
 {
     $this->processBuilder->addEnvironmentVariables($variables);
     return $this;
 }
开发者ID:gplanchat,项目名称:grenade,代码行数:16,代码来源:ProcessBuilderProxyTrait.php


注:本文中的Symfony\Component\Process\ProcessBuilder::addEnvironmentVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。