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


PHP Process\ProcessUtils类代码示例

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


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

示例1: testProjectNew

 public function testProjectNew()
 {
     $projectDir = sprintf('%s/my_test_project', sys_get_temp_dir());
     $this->fs->remove($projectDir);
     $output = $this->runCommand(sprintf('php crush.phar project new %s', ProcessUtils::escapeArgument($projectDir)));
     $this->assertContains('Projects process exited.', $output);
 }
开发者ID:cocomore,项目名称:crush,代码行数:7,代码来源:CommandsTest.php

示例2: formatSuggestion

 /**
  * @param Process $process
  *
  * @return string
  */
 public function formatSuggestion(Process $process)
 {
     $pattern = '%s ';
     $dryrun = sprintf($pattern, ProcessUtils::escapeArgument('--dry-run'));
     $formatJson = sprintf($pattern, ProcessUtils::escapeArgument('--format=json'));
     return str_replace([$dryrun, $formatJson], '', $process->getCommandLine());
 }
开发者ID:phpro,项目名称:grumphp,代码行数:12,代码来源:PhpCsFixerFormatter.php

示例3: createProcessForFile

 /**
  * Create process that lint PHP file.
  *
  * @param string $path path to file
  *
  * @return Process
  */
 public function createProcessForFile($path)
 {
     $process = new Process('php -l ' . ProcessUtils::escapeArgument($path));
     $process->setTimeout(null);
     $process->run();
     return $process;
 }
开发者ID:brighten01,项目名称:opencloud-zendframework,代码行数:14,代码来源:LintManager.php

示例4: escape

 /**
  * Escape the provided value, unless it contains only alphanumeric
  * plus a few other basic characters.
  *
  * @param string $value
  * @return string
  */
 public static function escape($value)
 {
     if (preg_match('/^[a-zA-Z0-9\\/.@~_-]*$/', $value)) {
         return $value;
     }
     return ProcessUtils::escapeArgument($value);
 }
开发者ID:greg-1-anderson,项目名称:Robo,代码行数:14,代码来源:CommandArguments.php

示例5: lintFile

 /**
  * @param $path
  * @return Process
  */
 protected function lintFile($path)
 {
     $lintProcess = new Process('php -l ' . ProcessUtils::escapeArgument($path));
     $lintProcess->setTimeout(null);
     $lintProcess->run();
     return strpos($lintProcess->getOutput(), 'No syntax errors detected in') === 0;
 }
开发者ID:hacfi,项目名称:php-file-analyzer,代码行数:11,代码来源:Analyzer.php

示例6: scan

 /**
  * @param array $targets
  * @param array $ports
  *
  * @return Host[]
  */
 public function scan(array $targets, array $ports = array())
 {
     $targets = implode(' ', array_map(function ($target) {
         return ProcessUtils::escapeArgument($target);
     }, $targets));
     $options = array();
     if (true === $this->enableOsDetection) {
         $options[] = '-O';
     }
     if (true === $this->enableServiceInfo) {
         $options[] = '-sV';
     }
     if (true === $this->enableVerbose) {
         $options[] = '-v';
     }
     if (true === $this->disablePortScan) {
         $options[] = '-sn';
     } elseif (!empty($ports)) {
         $options[] = '-p ' . implode(',', $ports);
     }
     if (true === $this->disableReverseDNS) {
         $options[] = '-n';
     }
     if (true == $this->treatHostsAsOnline) {
         $options[] = '-Pn';
     }
     $options[] = '-oX';
     $command = sprintf('%s %s %s %s', $this->executable, implode(' ', $options), ProcessUtils::escapeArgument($this->outputFile), $targets);
     $this->executor->execute($command);
     if (!file_exists($this->outputFile)) {
         throw new \RuntimeException(sprintf('Output file not found ("%s")', $this->outputFile));
     }
     return $this->parseOutputFile($this->outputFile);
 }
开发者ID:willdurand,项目名称:nmap,代码行数:40,代码来源:Nmap.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $host = $input->getOption('host');
     $port = $input->getOption('port');
     $daux = $this->prepareDaux($input);
     // Daux can only serve HTML
     $daux->getParams()->setFormat('html');
     chdir(__DIR__ . '/../../');
     putenv('DAUX_SOURCE=' . $daux->getParams()->getDocumentationDirectory());
     putenv('DAUX_THEME=' . $daux->getParams()->getThemesPath());
     putenv('DAUX_CONFIGURATION=' . $daux->getParams()->getConfigurationOverrideFile());
     putenv('DAUX_EXTENSION=' . DAUX_EXTENSION);
     $base = ProcessUtils::escapeArgument(__DIR__ . '/../../');
     $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder())->find(false));
     echo "Daux development server started on http://{$host}:{$port}/\n";
     if (defined('HHVM_VERSION')) {
         if (version_compare(HHVM_VERSION, '3.8.0') >= 0) {
             passthru("{$binary} -m server -v Server.Type=proxygen -v Server.SourceRoot={$base}/ -v Server.IP={$host} -v Server.Port={$port} -v Server.DefaultDocument=server.php -v Server.ErrorDocument404=server.php");
         } else {
             throw new Exception("HHVM's built-in server requires HHVM >= 3.8.0.");
         }
     } else {
         passthru("{$binary} -S {$host}:{$port} {$base}/index.php");
     }
 }
开发者ID:justinwalsh,项目名称:daux.io,代码行数:25,代码来源:Serve.php

示例8: prepare

 public function prepare(BehatWrapper $behat, BehatCommand $command, $cwd = null)
 {
     // Build the command line options, flags, and arguments.
     $binary = ProcessUtils::escapeArgument($behat->getBehatBinary());
     $commandLine = rtrim($binary . ' ' . $command->getCommandLine());
     parent::__construct($commandLine, $cwd, null, null, $behat->getTimeout(), array());
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:7,代码来源:BehatProcess.php

示例9: findComposer

 /**
  * Get the composer command for the environment.
  *
  * @return string
  */
 protected function findComposer()
 {
     if (!$this->files->exists($this->workingPath . '/composer.phar')) {
         return 'composer';
     }
     $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder())->find(false));
     return "{$binary} composer.phar";
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:13,代码来源:Composer.php

示例10: checkoutReference

 private function checkoutReference(Source $source, $path)
 {
     $process = new Process(sprintf('git checkout -f %s -- && git reset --hard %1$s --', ProcessUtils::escapeArgument($source->getReference())), realpath($path));
     $process->run();
     if (preg_match('/fatal: reference is not a tree: (.+)/', $process->getErrorOutput(), $matches)) {
         throw new RuntimeException('Failed to checkout ' . $source->getReference());
     }
 }
开发者ID:pixelpolishers,项目名称:resolver,代码行数:8,代码来源:Git.php

示例11: ProcessArgumentsCollection

 function it_outputs_the_command_when_run_very_very_verbose(GrumPHP $config, ExternalCommand $externalCommandLocator, IOInterface $io)
 {
     $io->isVeryVerbose()->willReturn(true);
     $command = '/usr/bin/grumphp';
     $io->write(PHP_EOL . 'Command: ' . ProcessUtils::escapeArgument($command), true)->shouldBeCalled();
     $arguments = new ProcessArgumentsCollection([$command]);
     $process = $this->buildProcess($arguments);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:8,代码来源:ProcessBuilderSpec.php

示例12: extractShell

 private function extractShell()
 {
     $command = 'tar -jxvf  ' . ProcessUtils::escapeArgument($this->file) . ' -C ' . ProcessUtils::escapeArgument($this->path) . ' && chmod -R u+w ' . ProcessUtils::escapeArgument($this->path);
     $process = new Process($command);
     $process->run();
     echo $process->getErrorOutput();
     return $process->isSuccessful();
 }
开发者ID:JBarnden,项目名称:updater,代码行数:8,代码来源:BzipExtractor.php

示例13: execute

 /**
  * Executes command to start a development server.
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $host = $input->getOption('host');
     $port = $input->getOption('port');
     $base = ProcessUtils::escapeArgument(realpath(__DIR__ . '/../../../../public'));
     $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder())->find(false));
     $output->writeln("<info>PHP development server started on http://{$host}:{$port}</info>");
     passthru("{$binary} -S {$host}:{$port} -t {$base}");
 }
开发者ID:mobister,项目名称:wordpress,代码行数:16,代码来源:ServeCommand.php

示例14: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $host = $input->getOption('host');
     $port = $input->getOption('port');
     $this->info('Blog-Tree development server started on http://' . $host . ':' . $port . '/');
     $base = ProcessUtils::escapeArgument($this->app->basePath());
     $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder())->find(false));
     passthru("{$binary} -S {$host}:{$port} {$base}/server.php");
 }
开发者ID:blog-tree,项目名称:lib-bt-kernel,代码行数:9,代码来源:ServeCommand.php

示例15: execute

 /**
  * Ejecuta el comando
  * 
  * @param InputInterface  $input  Instancia
  * @param OutputInterface $output Instancia
  * 
  * @return [type]                  [description]
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $host = $input->getOption('host');
     $port = $input->getOption('port');
     $target = $input->getOption('target');
     $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder())->find(false));
     $output->writeln("Resty development server started on http://{$host}:{$port}/ -t {$target}");
     $cmd = "{$binary} -S {$host}:{$port} -t {$target}";
     passthru($cmd);
 }
开发者ID:restyphp,项目名称:resty,代码行数:18,代码来源:ServerCommand.php


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