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


PHP ProcessBuilder::getProcess方法代码示例

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


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

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

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

示例3: start

 /**
  * Asynchronously start mediainfo operation.
  * Make call to MediaInfoCommandRunner::wait() afterwards to receive output.
  */
 public function start()
 {
     $this->processBuilder->add($this->filePath);
     $this->processAsync = $this->processBuilder->getProcess();
     // just takes advantage of symfony's underlying Process framework
     // process runs in background
     $this->processAsync->start();
 }
开发者ID:petrofcz,项目名称:php-mediainfo,代码行数:12,代码来源:MediaInfoCommandRunner.php

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

示例5: run

 /**
  * @return string
  */
 public function run()
 {
     $this->processBuilder->add($this->filePath);
     $process = $this->processBuilder->getProcess();
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
     return $process->getOutput();
 }
开发者ID:yupmin,项目名称:php-chardet,代码行数:13,代码来源:ChardetCommandRunner.php

示例6: executeCommand

 /**
  * @return string
  * @throws \RuntimeException
  */
 protected function executeCommand()
 {
     $this->processBuilder->setArguments(array());
     $this->processBuilder->add($this->filePath);
     $process = $this->processBuilder->getProcess();
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
     return $process->getOutput();
 }
开发者ID:mhor,项目名称:php-mp3info,代码行数:15,代码来源:PhpMp3Info.php

示例7: getProp

 /**
  * Get a property from youtube-dl.
  *
  * @param string $url    URL to parse
  * @param string $format Format
  * @param string $prop   Property
  *
  * @return string
  */
 private function getProp($url, $format = null, $prop = 'dump-json')
 {
     $this->procBuilder->setArguments(['--' . $prop, $url]);
     if (isset($format)) {
         $this->procBuilder->add('-f ' . $format);
     }
     $process = $this->procBuilder->getProcess();
     $process->run();
     if (!$process->isSuccessful()) {
         throw new \Exception($process->getErrorOutput());
     } else {
         return $process->getOutput();
     }
 }
开发者ID:rudloff,项目名称:alltube,代码行数:23,代码来源:VideoDownload.php

示例8: execute

 /**
  * Execute this task
  *
  * @param \TYPO3\Surf\Domain\Model\Node $node
  * @param \TYPO3\Surf\Domain\Model\Application $application
  * @param \TYPO3\Surf\Domain\Model\Deployment $deployment
  * @param array $options
  * @throws \TYPO3\Surf\Exception\InvalidConfigurationException
  * @return void
  */
 public function execute(Node $node, Application $application, Deployment $deployment, array $options = array())
 {
     $this->assertRequiredOptionsExist($options);
     $dumpCommand = new ProcessBuilder();
     $dumpCommand->setPrefix('mysqldump');
     $dumpCommand->setArguments(array('-h', $options['sourceHost'], '-u', $options['sourceUser'], '-p' . $options['sourcePassword'], $options['sourceDatabase']));
     $mysqlCommand = new ProcessBuilder();
     $mysqlCommand->setPrefix('mysql');
     $mysqlCommand->setArguments(array('-h', $options['targetHost'], '-u', $options['targetUser'], '-p' . $options['targetPassword'], $options['targetDatabase']));
     $arguments = array();
     $username = isset($options['username']) ? $options['username'] . '@' : '';
     $hostname = $node->getHostname();
     $arguments[] = $username . $hostname;
     if ($node->hasOption('port')) {
         $arguments[] = '-P';
         $arguments[] = $node->getOption('port');
     }
     $arguments[] = $mysqlCommand->getProcess()->getCommandLine();
     $sshCommand = new ProcessBuilder();
     $sshCommand->setPrefix('ssh');
     $sshCommand->setArguments($arguments);
     $command = $dumpCommand->getProcess()->getCommandLine() . ' | ' . $sshCommand->getProcess()->getCommandLine();
     $localhost = new Node('localhost');
     $localhost->setHostname('localhost');
     $this->shell->executeOrSimulate($command, $localhost, $deployment);
 }
开发者ID:TYPO3,项目名称:Surf,代码行数:36,代码来源:DumpDatabaseTask.php

示例9: processWithConfiguration

 /**
  * @param BinaryInterface $binary
  * @param array           $options
  *
  * @throws ProcessFailedException
  *
  * @return BinaryInterface
  */
 public function processWithConfiguration(BinaryInterface $binary, array $options)
 {
     $type = strtolower($binary->getMimeType());
     if (!in_array($type, array('image/jpeg', 'image/jpg'))) {
         return $binary;
     }
     $pb = new ProcessBuilder(array($this->mozjpegBin));
     // Places emphasis on DC
     $pb->add('-quant-table');
     $pb->add(2);
     $transformQuality = array_key_exists('quality', $options) ? $options['quality'] : $this->quality;
     if ($transformQuality !== null) {
         $pb->add('-quality');
         $pb->add($transformQuality);
     }
     $pb->add('-optimise');
     // Favor stdin/stdout so we don't waste time creating a new file.
     $pb->setInput($binary->getContent());
     $proc = $pb->getProcess();
     $proc->run();
     if (false !== strpos($proc->getOutput(), 'ERROR') || 0 !== $proc->getExitCode()) {
         throw new ProcessFailedException($proc);
     }
     $result = new Binary($proc->getOutput(), $binary->getMimeType(), $binary->getFormat());
     return $result;
 }
开发者ID:aminin,项目名称:LiipImagineBundle,代码行数:34,代码来源:MozJpegPostProcessor.php

示例10: run

 /**
  * @throws PhpCsFixerException
  */
 public function run()
 {
     foreach ($this->levels as $level => $value) {
         if (true === $value) {
             $this->outputHandler->setTitle('Checking ' . strtoupper($level) . ' code style with PHP-CS-FIXER');
             $this->output->write($this->outputHandler->getTitle());
             $errors = array();
             foreach ($this->files as $file) {
                 $srcFile = preg_match($this->filesToAnalyze, $file);
                 if (!$srcFile) {
                     continue;
                 }
                 $processBuilder = new ProcessBuilder(array('php', 'bin/php-cs-fixer', '--dry-run', 'fix', $file, '--level=' . $level));
                 $phpCsFixer = $processBuilder->getProcess();
                 $phpCsFixer->run();
                 if (false === $phpCsFixer->isSuccessful()) {
                     $errors[] = $phpCsFixer->getOutput();
                 }
             }
             if ($errors) {
                 $this->output->writeln(BadJobLogo::paint());
                 throw new PhpCsFixerException(implode('', $errors));
             }
             $this->output->writeln($this->outputHandler->getSuccessfulStepMessage());
         }
     }
 }
开发者ID:dw250100785,项目名称:php-git-hooks,代码行数:30,代码来源:PhpCsFixerHandler.php

示例11: analyze

 /**
  * {@inheritdoc}
  */
 public function analyze($analyzedFileName = null)
 {
     $result = new \SCQAT\Result();
     $processBuilder = new ProcessBuilder(array($this->language->configuration["command"], $this->context->vendorDirectory . "bin/php-cs-fixer", "--level=psr2", "--dry-run", "--verbose", "fix", $analyzedFileName));
     $process = $processBuilder->getProcess();
     $process->run();
     if (!$process->isSuccessful()) {
         $result->isSuccess = false;
         $result->value = "KO";
         $description = "";
         $outputLines = explode("\n", trim($process->getOutput()));
         foreach ($outputLines as $line) {
             // remove all output useless lines
             if (strpos($line, $analyzedFileName) !== false) {
                 // remove filename and useles chars to just keep fixers violated
                 $description = trim(substr($line, strpos($line, $analyzedFileName) + strlen($analyzedFileName)), " ()");
             }
         }
         $result->description = "Triggered fixers : " . $description;
     } else {
         $result->isSuccess = true;
         $result->value = "OK";
     }
     return $result;
 }
开发者ID:clorichel,项目名称:SCQAT,代码行数:28,代码来源:PhpCsFixer.php

示例12: runCommand

 protected function runCommand($cmd)
 {
     $builder = new ProcessBuilder($cmd);
     $process = $builder->getProcess();
     $process->run();
     return $process->getOutput();
 }
开发者ID:pierredup,项目名称:gush-block,代码行数:7,代码来源:AbstractGushTask.php

示例13: format

    /**
     * {@inheritDoc}
     */
    public function format($string)
    {
        static $format = <<<EOF
package main

import "fmt"
import "github.com/russross/blackfriday"

func main() {
    input := []byte("%s")
    output := blackfriday.MarkdownCommon(input)
    fmt.Printf(string(output[:]))
}
EOF;
        $input = tempnam(sys_get_temp_dir(), 'fabricius_blackfriday');
        $input .= '.go';
        file_put_contents($input, sprintf($format, addcslashes($string, "\n\"")));
        $pb = new ProcessBuilder(array($this->goBin, 'run', $input));
        $proc = $pb->getProcess();
        $code = $proc->run();
        unlink($input);
        if (0 !== $code) {
            $message = sprintf("An error occurred while running:\n%s", $proc->getCommandLine());
            $errorOutput = $proc->getErrorOutput();
            if (!empty($errorOutput)) {
                $message .= "\n\nError Output:\n" . str_replace("\r", '', $errorOutput);
            }
            $output = $proc->getOutput();
            if (!empty($output)) {
                $message .= "\n\nOutput:\n" . str_replace("\r", '', $output);
            }
            throw new RuntimeException($message);
        }
        return $proc->getOutput();
    }
开发者ID:fabricius,项目名称:fabricius,代码行数:38,代码来源:MarkdownBlackFridayHandler.php

示例14: execute

 /**
  * @param string $file
  *
  * @return Process
  */
 private function execute($file)
 {
     $processBuilder = new ProcessBuilder(['php', '-l', $file]);
     $process = $processBuilder->getProcess();
     $process->run();
     return $process;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:12,代码来源:PhpLintToolProcessor.php

示例15: execute

 /**
  * @param string $file
  * @param string $standard
  *
  * @return Process
  */
 private function execute($file, $standard)
 {
     $processBuilder = new ProcessBuilder(['php', $this->toolPathFinder->find('phpcs'), '--standard=' . $standard, $file]);
     $process = $processBuilder->getProcess();
     $process->run();
     return $process;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:13,代码来源:PhpCsToolProcessor.php


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