本文整理汇总了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();
}
示例2: isSuccessful
private function isSuccessful()
{
if (null === $this->isSuccessful) {
$this->process->wait();
$this->isSuccessful = $this->process->isSuccessful();
}
return $this->isSuccessful;
}
示例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();
}
示例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();
}
示例5: runCommand
private function runCommand($cmd)
{
$process = new Process($cmd);
$process->run();
$process->wait();
return $process;
}
示例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>');
}
示例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();
}
示例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));
}
}
示例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);
}
}
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
});
}