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


PHP ProcessBuilder::setArguments方法代码示例

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


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

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

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

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

示例5: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $address = $input->getArgument('address') ?: $this->serverAddress;
     $output->writeln(sprintf("Server running on <info>%s</info>\n", $address));
     $process = $this->processBuilder->setArguments([PHP_BINARY, '-S', $address])->setWorkingDirectory(ROOT . 'web/')->setTimeout(null)->getProcess();
     $process->run(function ($type, $buffer) use($output, $input) {
         unset($type);
         if (!$input->getOption('quiet')) {
             $output->write($buffer);
         }
     });
 }
开发者ID:brainexe,项目名称:core,代码行数:15,代码来源:ServerRunCommand.php

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

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

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

示例9: testShouldSetArguments

 public function testShouldSetArguments()
 {
     $pb = new ProcessBuilder(array('initial'));
     $pb->setArguments(array('second'));
     $proc = $pb->getProcess();
     $this->assertContains("second", $proc->getCommandLine());
 }
开发者ID:ronaldlunaramos,项目名称:webstore,代码行数:7,代码来源:ProcessBuilderTest.php

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

示例11: FilesCollection

 function it_does_not_do_anything_if_there_are_no_keywords(ProcessBuilder $processBuilder, ContextInterface $context)
 {
     $processBuilder->add(Argument::any())->shouldNotBeCalled();
     $processBuilder->setArguments(Argument::any())->shouldNotBeCalled();
     $processBuilder->getProcess()->shouldNotBeCalled();
     $context->getFiles()->willReturn(new FilesCollection(array(new SplFileInfo('file1.php'))));
     $this->run($context)->shouldBeNull();
 }
开发者ID:Bilge,项目名称:grumphp,代码行数:8,代码来源:BlacklistSpec.php

示例12: FilesCollection

 function it_does_not_do_anything_if_there_are_no_keywords(ProcessBuilder $processBuilder)
 {
     $processBuilder->add(Argument::any())->shouldNotBeCalled();
     $processBuilder->setArguments(Argument::any())->shouldNotBeCalled();
     $processBuilder->getProcess()->shouldNotBeCalled();
     $files = new FilesCollection(array(new SplFileInfo('file1.php')));
     $this->run($files)->shouldBeNull();
 }
开发者ID:brzuchal,项目名称:grumphp,代码行数:8,代码来源:BlacklistSpec.php

示例13: testArrayPrefixesArePrependedToAllGeneratedProcess

 public function testArrayPrefixesArePrependedToAllGeneratedProcess()
 {
     $pb = new ProcessBuilder();
     $pb->setPrefix(array('/usr/bin/php', 'composer.phar'));
     $proc = $pb->setArguments(array('-v'))->getProcess();
     if ('\\' === DIRECTORY_SEPARATOR) {
         $this->assertEquals('"/usr/bin/php" "composer.phar" "-v"', $proc->getCommandLine());
     } else {
         $this->assertEquals("'/usr/bin/php' 'composer.phar' '-v'", $proc->getCommandLine());
     }
     $proc = $pb->setArguments(array('-i'))->getProcess();
     if ('\\' === DIRECTORY_SEPARATOR) {
         $this->assertEquals('"/usr/bin/php" "composer.phar" "-i"', $proc->getCommandLine());
     } else {
         $this->assertEquals("'/usr/bin/php' 'composer.phar' '-i'", $proc->getCommandLine());
     }
 }
开发者ID:unexge,项目名称:symfony,代码行数:17,代码来源:ProcessBuilderTest.php

示例14: createProcess

 /**
  * Create process object
  *
  * @param string $inputFile
  *
  * @throws \RuntimeException
  *
  * @return Process
  */
 public function createProcess($inputFile)
 {
     if (!is_file($inputFile)) {
         throw new \RuntimeException('Input file does not exist');
     }
     $arguments = array_values($this->arguments->toArray());
     array_push($arguments, '-f', $inputFile);
     return $this->builder->setArguments($arguments)->getProcess();
 }
开发者ID:etd-framework,项目名称:Ghostscript,代码行数:18,代码来源:AbstractDevice.php

示例15: getProcess

 /**
  * @return Process
  */
 private function getProcess()
 {
     if (!$this->process) {
         $this->processBuilder->setPrefix($this->utilityCommands[$this->utility]);
         $this->processBuilder->setArguments(array_merge($this->utilityArguments[$this->utility], [$this->image]));
         $this->process = $this->processBuilder->getProcess();
     }
     return $this->process;
 }
开发者ID:archfizz,项目名称:phpairplay,代码行数:12,代码来源:Mirror.php


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