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


PHP ProcessBuilder::setPrefix方法代码示例

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


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

示例1: runSampleDataInstaller

 protected function runSampleDataInstaller()
 {
     $installationArgs = $this->config->getArray('installation_args');
     $processBuilder = new ProcessBuilder(['php', 'bin/magento', 'sampledata:deploy']);
     if (!OperatingSystem::isWindows()) {
         $processBuilder->setPrefix('/usr/bin/env');
     }
     $process = $processBuilder->getProcess();
     $process->setTimeout(86400);
     $process->start();
     $process->wait(function ($type, $buffer) {
         $this->output->write($buffer, false);
     });
     // @TODO Refactor code duplication
     if (!OperatingSystem::isWindows()) {
         $processBuilder->setPrefix('/usr/bin/env');
     }
     $processBuilder = new ProcessBuilder(array('php', 'bin/magento', 'setup:upgrade'));
     $process = $processBuilder->getProcess();
     $process->setTimeout(86400);
     $process->start();
     $process->wait(function ($type, $buffer) {
         $this->output->write($buffer, false);
     });
 }
开发者ID:brentwpeterson,项目名称:n98-magerun2,代码行数:25,代码来源:InstallSampleData.php

示例2: buildProcess

 /**
  * Build a Process to run tivodecode decoding a file with a MAK
  *
  * @param string $mak    TiVo's Media Access Key
  * @param string $input  Where the encoded TiVo file is
  * @param string $output Where the decoded MPEG file goes
  *
  * @return Process
  */
 protected function buildProcess($mak, $input, $output)
 {
     $this->builder->setPrefix('/usr/local/bin/tivodecode');
     $this->builder->setArguments([$input, '--mak=' . $mak, '--no-verify', '--out=' . $output]);
     $this->builder->setTimeout(null);
     return $this->builder->getProcess();
 }
开发者ID:jimlind,项目名称:tivo-php,代码行数:16,代码来源:VideoDecoder.php

示例3: __construct

 public function __construct(string $directory)
 {
     $this->builder = new ProcessBuilder();
     $this->builder->setPrefix('./vendor/bin/php-cs-fixer');
     $this->builder->add('fix');
     $this->builder->add($directory);
 }
开发者ID:Symplify,项目名称:CodingStandard,代码行数:7,代码来源:PhpCsFixerProcessBuilder.php

示例4: buildProcess

 /**
  * Build a Process to run avahi-browse looking for TiVo on TCP
  *
  * @return Process
  */
 protected function buildProcess()
 {
     $this->builder->setPrefix('avahi-browse');
     $this->builder->setArguments(['--ignore-local', '--resolve', '--terminate', '_tivo-videos._tcp']);
     $this->builder->setTimeout(60);
     return $this->builder->getProcess();
 }
开发者ID:jimlind,项目名称:tivo-php,代码行数:12,代码来源:TiVoFinder.php

示例5: __construct

 public function __construct(string $directory)
 {
     $this->builder = new ProcessBuilder();
     $this->builder->setPrefix('./vendor/bin/phpcs');
     $this->builder->add($directory);
     $this->builder->add('--colors');
     $this->builder->add('-p');
     $this->builder->add('-s');
 }
开发者ID:Symplify,项目名称:CodingStandard,代码行数:9,代码来源:PhpCsProcessBuilder.php

示例6: __construct

 public function __construct($source = null)
 {
     $bin = $this->findExecutable($this->commands);
     $this->builder = new ProcessBuilder();
     $this->builder->setPrefix($bin);
     if (!is_null($source)) {
         $this->setSource($source);
     }
 }
开发者ID:kurbits,项目名称:javascript,代码行数:9,代码来源:ExternalRunner.php

示例7: install

 /**
  * Function to install Laravel
  * 
  * @return string directory where app was installed
  */
 public function install()
 {
     $this->command->comment("Foreman", "Installing fresh Laravel app");
     $this->builder->setPrefix('composer');
     $this->builder->setArguments(['create-project', 'laravel/laravel', $this->appDir, '--prefer-dist']);
     $this->builder->getProcess()->run();
     $this->command->comment("Foreman", "Done, Laravel installed at: {$this->appDir}");
     return $this->appDir;
 }
开发者ID:dhaval48,项目名称:foreman,代码行数:14,代码来源:Laravel.php

示例8: initProcessBuilder

 /**
  * @param string|array $prefix A command prefix or an array of command prefixes
  * @param null|string $cwd The working directory
  * @param float|null $timeout
  */
 private function initProcessBuilder(array $prefix = [], $cwd = null, $timeout = null)
 {
     $this->processBuilder = new ProcessBuilder();
     $this->processBuilder->setPrefix($prefix);
     if ($cwd !== null) {
         $this->setWorkingDirectory($cwd);
     }
     if ($timeout !== null) {
         $this->setTimeout($timeout);
     }
 }
开发者ID:gplanchat,项目名称:grenade,代码行数:16,代码来源:ProcessBuilderProxyTrait.php

示例9: __construct

 /**
  * VideoDownload constructor.
  */
 public function __construct(Config $config = null)
 {
     if (isset($config)) {
         $this->config = $config;
     } else {
         $this->config = Config::getInstance();
     }
     $this->procBuilder = new ProcessBuilder();
     if (!is_file($this->config->youtubedl)) {
         throw new \Exception("Can't find youtube-dl at " . $this->config->youtubedl);
     } elseif (!is_file($this->config->python)) {
         throw new \Exception("Can't find Python at " . $this->config->python);
     }
     $this->procBuilder->setPrefix(array_merge([$this->config->python, $this->config->youtubedl], $this->config->params));
 }
开发者ID:rudloff,项目名称:alltube,代码行数:18,代码来源:VideoDownload.php

示例10: execute

 public function execute()
 {
     global $wgPygmentizePath;
     function lang_filter($val)
     {
         return preg_match('/^[a-zA-Z0-9\\-_]+$/', $val);
     }
     $header = '// Generated by ' . basename(__FILE__) . "\n\n";
     $lexers = array();
     $builder = new ProcessBuilder();
     $builder->setPrefix($wgPygmentizePath);
     $process = $builder->add('-L')->add('lexer')->getProcess();
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
     $output = $process->getOutput();
     foreach (explode("\n", $output) as $line) {
         if (substr($line, 0, 1) === '*') {
             $newLexers = explode(', ', trim($line, "* :\n"));
             $lexers = array_merge($lexers, $newLexers);
         }
     }
     $lexers = array_unique($lexers);
     sort($lexers);
     $code = "<?php\n" . $header . 'return ' . var_export($lexers, true) . ";\n";
     $code = preg_replace('/(\\d+ \\=\\>| (?=\\())/i', '', $code);
     $code = preg_replace("/^ +/m", "\t", $code);
     file_put_contents(__DIR__ . '/../SyntaxHighlight_GeSHi.lexers.php', $code);
     $this->output("Updated language list written to SyntaxHighlight_GeSHi.lexers.php\n");
 }
开发者ID:sadnanalmanir,项目名称:mediawiki-extensions-SyntaxHighlight_GeSHi,代码行数:31,代码来源:updateLexerList.php

示例11: createProcessBuilder

 /**
  * @return ProcessBuilder
  */
 protected function createProcessBuilder()
 {
     $this->guardIsExecutable($this->executable);
     $processBuilder = new ProcessBuilder();
     $processBuilder->setPrefix($this->executable);
     return $processBuilder;
 }
开发者ID:phpro,项目名称:zf-filesystem,代码行数:10,代码来源:ExifTool.php

示例12: exec

 /**
  * Execute command
  *
  * @return int|mixed
  * @throws \Exception
  */
 public function exec()
 {
     $args = func_get_args();
     if (!$this->cmd) {
         throw new FWException('no cmd provided', 1);
     }
     $build = new ProcessBuilder();
     $pro = $build->setPrefix($this->cmd)->setArguments($args)->getProcess();
     $pro->setTimeout($this->timeout);
     $rm = new \ReflectionMethod($this, 'output');
     $func = $rm->getClosure($this);
     $re = 0;
     if ($this->async) {
         $pro->start($func);
     } else {
         try {
             $pro->mustRun($func);
             $this->out = $pro->getOutput();
             $re = $this->out;
         } catch (ProcessFailedException $e) {
             getLog()->error($e->getMessage());
             $re = 1;
         }
     }
     return $re;
 }
开发者ID:wwtg99,项目名称:flight2wwu,代码行数:32,代码来源:CommandPlugin.php

示例13: create

 /**
  * @return Process
  */
 public function create()
 {
     $processBuilder = new ProcessBuilder();
     $processBuilder->setPrefix('vendor/bin/behat');
     $processBuilder->setArguments(['--init']);
     return $processBuilder->getProcess();
 }
开发者ID:quickstrap,项目名称:quickstrap,代码行数:10,代码来源:ProcessFactory.php

示例14: 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

示例15: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     echo "Run task: #" . $this->job_id, "\n";
     $task = Tasks::find($this->job_id);
     $task->status = Tasks::RUN;
     $task->save();
     $client = new \Hoa\Websocket\Client(new \Hoa\Socket\Client('tcp://127.0.0.1:8889'));
     $client->setHost('127.0.0.1');
     $client->connect();
     $client->send(json_encode(["command" => webSocket::BROADCASTIF, "jobid" => $this->job_id, "msg" => json_encode(["jid" => $this->job_id, "status" => Tasks::RUN])]));
     $builder = new ProcessBuilder();
     $builder->setPrefix('ansible-playbook');
     $builder->setArguments(["-i", "inv" . $this->job_id, "yml" . $this->job_id]);
     $builder->setWorkingDirectory(storage_path("roles"));
     $process = $builder->getProcess();
     $process->run();
     //echo $process->getOutput() . "\n";
     $client->send(json_encode(["command" => webSocket::BROADCASTIF, "jobid" => $this->job_id, "msg" => json_encode(["jid" => $this->job_id, "status" => Tasks::FINISH])]));
     $client->close();
     $task->status = Tasks::FINISH;
     $task->content = file_get_contents(storage_path("tmp/log" . $this->job_id . ".txt"));
     $task->save();
     unlink(storage_path("roles/yml" . $this->job_id));
     unlink(storage_path("roles/inv" . $this->job_id));
     unlink(storage_path("tmp/log" . $this->job_id . ".txt"));
     echo "End task: #" . $this->job_id, "\n";
 }
开发者ID:mangareader,项目名称:laravel-ansible,代码行数:32,代码来源:runAnsible.php


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