當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Process::wait方法代碼示例

本文整理匯總了PHP中Symfony\Component\Process\Process::wait方法的典型用法代碼示例。如果您正苦於以下問題:PHP Process::wait方法的具體用法?PHP Process::wait怎麽用?PHP Process::wait使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Process\Process的用法示例。


在下文中一共展示了Process::wait方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: iRunBehat

 /**
  * @When /^I run behat$/
  */
 public function iRunBehat()
 {
     $this->process->setWorkingDirectory($this->workingDir);
     $this->process->setCommandLine(sprintf('%s %s %s %s', $this->phpBin, escapeshellarg(BEHAT_BIN_PATH), strtr('--format-settings=\'{"timer": false}\'', array('\'' => '"', '"' => '\\"')), '--format=progress'));
     $this->process->start();
     $this->process->wait();
 }
開發者ID:icambridge,項目名稱:BehatPageObjectExtension,代碼行數:10,代碼來源:BehatRunnerContext.php

示例2: isSuccessful

 private function isSuccessful()
 {
     if (null === $this->isSuccessful) {
         $this->process->wait();
         $this->isSuccessful = $this->process->isSuccessful();
     }
     return $this->isSuccessful;
 }
開發者ID:fabpot,項目名稱:php-cs-fixer,代碼行數:8,代碼來源:ProcessLintingResult.php

示例3: iRunBehat

 /**
  * Runs behat command with provided parameters
  *
  * @When /^I run "behat(?: ((?:\"|[^"])*))?"$/
  *
  * @param string $argumentsString
  */
 public function iRunBehat($argumentsString = '')
 {
     $argumentsString = strtr($argumentsString, array('\'' => '"'));
     $this->process->setWorkingDirectory($this->workingDir);
     $this->process->setCommandLine(sprintf('%s %s %s %s', $this->phpBin, escapeshellarg(BEHAT_BIN_PATH), $argumentsString, strtr('--format-settings=\'{"timer": false}\' --no-colors', array('\'' => '"', '"' => '\\"'))));
     $this->process->start();
     $this->process->wait();
 }
開發者ID:cam5,項目名稱:WebApiExtension,代碼行數:15,代碼來源:FeatureContext.php

示例4: doRunBehat

 /**
  * @param string $configurationAsString
  */
 private function doRunBehat($configurationAsString)
 {
     $this->process->setWorkingDirectory($this->testApplicationDir);
     $this->process->setCommandLine(sprintf('%s %s %s', $this->phpBin, escapeshellarg(BEHAT_BIN_PATH), $configurationAsString));
     $this->process->start();
     $this->process->wait();
 }
開發者ID:Canu667,項目名稱:todoapp,代碼行數:10,代碼來源:FeatureContext.php

示例5: runCommand

 private function runCommand($cmd)
 {
     $process = new Process($cmd);
     $process->run();
     $process->wait();
     return $process;
 }
開發者ID:zsturgess,項目名稱:herokuizemebundle,代碼行數:7,代碼來源:ExtensionDependancyHelper.php

示例6: runProcess

 /**
  * Run a terminal command
  * @param  [array]         $command  [description]
  * @param  [path]          $directory [description]
  * @param  OutputInterface $output    [description]
  * @return [void]                     [description]
  */
 private function runProcess($command, $directory, $output, $alias)
 {
     $output->writeln('');
     if (is_array($command['line'])) {
         $commandLine = implode(' && ', $command['line']);
     } else {
         $commandLine = $command['line'];
     }
     $process = new Process($commandLine, $directory);
     $process->setTimeout(7600);
     $process->start();
     if ($output->isVerbose()) {
         $process->wait(function ($type, $buffer) {
             echo $buffer;
         });
     } else {
         $progress = new ProgressBar($output);
         $progress->setFormat("<comment>%message%</comment> [%bar%]");
         $progress->setMessage($command['title']);
         $progress->start();
         $progress->setRedrawFrequency(10000);
         while ($process->isRunning()) {
             $progress->advance();
         }
         $progress->finish();
         $progress->clear();
     }
     $output->writeln('');
     $output->write('<comment>' . $command['title'] . ' </comment><info>√ done</info>');
 }
開發者ID:nobox,項目名稱:nobox-laravel-installer,代碼行數:37,代碼來源:ProcessHelper.php

示例7: exec

 /**
  * Executes the command $cmd
  *
  * @param string $cmd
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @param bool $silent
  * @param bool $tty
  * @return string|void
  */
 public function exec($cmd, $output = null, $silent = FALSE, $tty = FALSE)
 {
     $process = new Process($cmd);
     if ($tty) {
         $process->setTty(TRUE);
     }
     $process->setTimeout(null);
     if (!$silent && $output) {
         $output->writeln($this->messageService->lightGray('-------------------------------------------------'));
         $output->writeln($this->messageService->lightGray('Executing: ' . $cmd));
         $messageService = $this->messageService;
         $process->setTimeout(3600);
         $process->start();
         $process->wait(function ($type, $buffer) use($output, $messageService) {
             if (Process::ERR === $type) {
                 $output->writeln($messageService->red('----> ERROR START'));
                 $output->write($messageService->red('----> ' . $buffer));
                 $output->writeln($messageService->red('----> ERROR END'));
             } else {
                 $output->write($messageService->green($buffer));
             }
         });
     } else {
         $process->run();
     }
     return $process->getOutput();
 }
開發者ID:kryslin,項目名稱:instance-manager,代碼行數:36,代碼來源:CommandService.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $distribution = $input->getArgument('distribution');
     $version = $input->getArgument('version');
     $download = $this->downloadProject($distribution, $version);
     $process = new Process("tar -xzf {$download['location']} -C /tmp/");
     $process->start();
     if (substr($version, 0, 3) == '7.x') {
         $finder = new Finder();
         $process->wait();
         // Find all modules dropped in to the distribution.
         $finder->files()->name("*.info");
         $filename = array();
         foreach ($finder->in($download['locationUncompressed']) as $file) {
             $filename[] = array('path' => $file->getRealPath(), 'filename' => $file->getFileName());
         }
         // Create the array for the containing modules.
         $return = array();
         foreach ($filename as $file) {
             $contents = $this->parse_info_file(file_get_contents($file['path']));
             $machine_name = substr($file['filename'], 0, strpos($file['filename'], '.'));
             $return[$machine_name] = array('name' => $contents['name'], 'machine_name' => substr($file['filename'], 0, strpos($file['filename'], '.')), 'core' => $contents['core'], 'version' => $contents['version'], 'status' => 'Enabled', 'package' => isset($contents['package']) ? $contents['package'] : null);
         }
         $output->write(json_encode($return));
     }
 }
開發者ID:jkswoods,項目名稱:stool,代碼行數:26,代碼來源:DistributionCommand.php

示例9: updateProject

 private function updateProject($docroot, $project, $version)
 {
     // Find the project, perform the update and applying patches (if applicable).
     $projectFilename = $this->substituteProjectName($project);
     $finder = new Finder();
     $finder->files()->name("{$projectFilename}.info");
     $filename = null;
     foreach ($finder->in($docroot) as $file) {
         $filename = $file->getRealPath();
     }
     if (!is_null($filename)) {
         $locationVars = $this->downloadProject($project, $version);
         $process = new Process("tar -xzf {$locationVars['location']} -C /tmp/");
         $process->start();
         $samuraiYmlLocation = $this->findSamuraiYaml($docroot);
         $process->wait();
         if (strlen($samuraiYmlLocation) > 0) {
             $this->applyPatches($locationVars, $docroot, $samuraiYmlLocation, $project);
         }
         $foldername = substr($filename, 0, -strlen("{$projectFilename}.info") - 1);
         $fs = new Filesystem();
         $fs->remove($foldername);
         $fs->rename($locationVars['locationUncompressed'], $foldername);
         if (strlen($samuraiYmlLocation) > 0) {
             $this->cleanupPatching($docroot);
         }
         $this->cleanupPatching($docroot);
     } elseif ($project == 'drupal') {
         $locationVars = $this->downloadProject($project, $version);
         $process = new Process("tar -xzf {$locationVars['location']} -C /tmp/");
         $process->start();
         $samuraiYmlLocation = $this->findSamuraiYaml($docroot);
         $process->wait();
         if (strlen($samuraiYmlLocation) > 0) {
             $this->applyPatches($locationVars, $docroot, $samuraiYmlLocation, $project);
         }
         $fs = new Filesystem();
         $newCoreFiles = scandir($locationVars['locationUncompressed']);
         foreach ($newCoreFiles as $key => $file) {
             switch ($file) {
                 case '..':
                 case '.':
                 case '.htaccess':
                 case '.gitignore':
                 case 'sites':
                     unset($newCoreFiles[$key]);
                     $file = null;
                     break;
             }
             if (!is_null($file)) {
                 $fs->remove($docroot . '/' . $file);
                 $fs->rename($locationVars['locationUncompressed'] . '/' . $file, $docroot . '/' . $file);
             }
         }
         if (strlen($samuraiYmlLocation) > 0) {
             $this->cleanupPatching($docroot);
         }
     }
 }
開發者ID:jkswoods,項目名稱:stool,代碼行數:59,代碼來源:UpdateCommand.php

示例10: execute

 /**
  * Execute a supervisorctl command
  *
  * @param $cmd string supervisorctl command
  * @return \Symfony\Component\Process\Process
  */
 public function execute($cmd)
 {
     $p = new Process(sprintf('supervisorctl%1$s %2$s', $this->configurationParameter, $cmd));
     $p->setWorkingDirectory($this->applicationDirectory);
     $p->run();
     $p->wait();
     return $p;
 }
開發者ID:robholmes,項目名稱:rabbitmq-supervisor-bundle,代碼行數:14,代碼來源:Supervisor.php

示例11: iRunPhpspec

 /**
  * Runs phpspec command with provided parameters
  *
  * @When /^I run "phpspec(?: ((?:\"|[^"])*))?"$/
  *
  * @param string $argumentsString
  */
 public function iRunPhpspec($argumentsString = '')
 {
     $argumentsString = strtr($argumentsString, array('\'' => '"'));
     $this->process->setWorkingDirectory($this->workingDir);
     $this->process->setCommandLine(sprintf('%s %s %s --no-interaction', $this->phpBin, escapeshellarg($this->getPhpspecBinPath()), $argumentsString));
     $this->process->start();
     $this->process->wait();
 }
開發者ID:codifico,項目名稱:phpspec-rest-view-extension,代碼行數:15,代碼來源:FeatureContext.php

示例12: execute

 /**
  * Process ctl command
  *
  * @param $cmd string supervisorctl command
  * @return Process
  */
 public function execute($cmd)
 {
     $p = new Process("supervisorctl " . $cmd);
     $p->setWorkingDirectory($this->appDir);
     $p->run();
     $p->wait();
     return $p;
 }
開發者ID:acassan,項目名稱:supervisord-bundle,代碼行數:14,代碼來源:Supervisord.php

示例13: iRunFiller

 /**
  * Runs behat command with provided parameters
  *
  * @When /^I run "filler(?: ((?:\"|[^"])*))?"$/
  *
  * @param   string $argumentsString
  */
 public function iRunFiller($argumentsString = '')
 {
     $argumentsString = str_replace('{dir}', $this->workingDir, strtr($argumentsString, array('\'' => '"')));
     $this->process->setWorkingDirectory($this->workingDir);
     $command = sprintf('%s %s %s', $this->phpBin, escapeshellarg($this->binDir . 'filler'), $argumentsString);
     $this->process->setCommandLine($command);
     $this->process->start();
     // TODO store exit code and process output for verification
     $exitCode = $this->process->wait();
 }
開發者ID:robmasters,項目名稱:filler,代碼行數:17,代碼來源:FeatureContext.php

示例14: addPromise

 /**
  * Add optional promise to process options
  *
  * @param Process $process
  * @return Promise
  */
 private function addPromise(Process $process)
 {
     /** @var Promise $promise */
     $promise = new Promise(function () use($process, &$promise) {
         $process->wait();
         $promise->resolve($process);
     });
     $process->setOptions([ProcessQueue::PROMISE_KEY => $promise]);
     return $promise;
 }
開發者ID:epfremmer,項目名稱:process-queue,代碼行數:16,代碼來源:ProcessQueueTest.php

示例15: handle

 /**
  * Execute the job.
  * @return void
  */
 public function handle()
 {
     $shell = "/bin/bash " . $this->shellPath . '/resources/shell/deploy.sh' . ' ' . base_path() . ' ' . env('SL_DEPLOY_BRANCH', 'master');
     $process = new Process($shell);
     $process->start();
     $process->wait(function ($type, $buffer) {
         if (Process::ERR === $type) {
             echo 'ERR > ' . $buffer;
         } else {
             echo 'OUT > ' . $buffer;
         }
     });
 }
開發者ID:imvkmark,項目名稱:sl-deploy,代碼行數:17,代碼來源:WebDeploy.php


注:本文中的Symfony\Component\Process\Process::wait方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。