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