當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。