本文整理汇总了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);
});
}
示例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();
}
示例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);
}
示例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();
}
示例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');
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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));
}
示例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;
}
示例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;
}
示例13: create
/**
* @return Process
*/
public function create()
{
$processBuilder = new ProcessBuilder();
$processBuilder->setPrefix('vendor/bin/behat');
$processBuilder->setArguments(['--init']);
return $processBuilder->getProcess();
}
示例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;
}
示例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";
}