本文整理汇总了PHP中Symfony\Component\Process\Process::setCommandLine方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::setCommandLine方法的具体用法?PHP Process::setCommandLine怎么用?PHP Process::setCommandLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\Process
的用法示例。
在下文中一共展示了Process::setCommandLine方法的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: 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}\'', array('\'' => '"', '"' => '\\"'))));
$this->process->run();
}
示例3: run
/**
* Run a command as a process.
*
* @param string $command
* @return self
*/
public function run($command)
{
$this->command = escapeshellcmd($command);
$this->process->setCommandLine($this->command);
$this->process->run();
$this->validateRun();
return $this;
}
示例4: archive
/**
* Executes the backup command.
*/
public function archive()
{
$this->process->setCommandLine($this->getCommand());
$this->process->run();
if ($this->process->getErrorOutput()) {
throw new \RuntimeException($this->process->getErrorOutput());
}
}
示例5: process
/**
* @param $command
* @throws ShellProcessFailed
* @throws \Symfony\Component\Process\Exception\LogicException
*/
public function process($command)
{
if (empty($command)) {
return;
}
$this->process->setCommandLine($command);
$this->process->run();
if (!$this->process->isSuccessful()) {
throw new ShellProcessFailed($this->process->getErrorOutput());
}
}
示例6: 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();
}
示例7: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->downloadConfiguration();
$library = new GLibc();
try {
$this->download()->extract();
$library->setEnv($this->env)->setProjectDir($this->baseDir)->initialize()->boot($input, $output);
$configure = $this->projectDir . '/' . $library->configure();
$this->projectDir = dirname($this->projectDir) . '/glibc-build';
$this->fs->mkdir($this->projectDir);
$this->output->write(' Building : ');
$process = new Process($configure, $this->projectDir, $this->env->toArray());
$process->setTimeout(0);
$process->run();
if ($process->isSuccessful()) {
$process->setCommandLine('make -j4 && make -j4 install');
$process->run();
}
if ($process->isSuccessful()) {
$message = '<info>✔</info>';
} else {
$message = '<error>✕</error>';
}
$this->output->writeln($message);
} catch (\Exception $e) {
$this->cleanUp();
throw $e;
}
$this->createConfiguration();
$this->output->writeln(sprintf(" <info>%s</info> Droidphp Installer <info>successfully configured</info> Now you can:\n" . " * Run :\n" . " 1. Execute the <comment>%s build:components</comment> command.\n" . " To Build the project\n\n", defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : '✔', basename($_SERVER['PHP_SELF'])));
}
示例8: iRunBehat
/**
* Runs Behat with provided parameters.
*
* @When /^I run "behat(?: ((?:\"|[^"])*))?"$/
*
* @param string $argumentsString
*/
public function iRunBehat($argumentsString = '')
{
$argumentsString = strtr($argumentsString, ['\'' => '"']);
$this->behatProcess->setWorkingDirectory($this->workingDir);
$this->behatProcess->setCommandLine(sprintf('%s %s %s %s', $this->phpBin, escapeshellarg(BEHAT_BIN_PATH), $argumentsString, strtr('--format-settings=\'{"timer": false}\' --no-colors', ['\'' => '"', '"' => '\\"'])));
$this->behatProcess->start();
$this->behatProcess->wait();
}
示例9: 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();
}
示例10:
function it_should_not_process_empty_commands(Process $process)
{
$process->setCommandLine('')->shouldNotBeCalled();
$process->run()->shouldNotBeCalled();
$process->isSuccessful()->willReturn(true);
/** @noinspection PhpParamsInspection */
$this->beConstructedWith($process);
$this->process('');
}
示例11: 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();
}
示例12: executeCommand
/**
* Executes a app/console command
*
* @param array $args Arguments
* @param OutputInterface $output Output
* @param string $message Message to be shown on error.
*
* @return integer|null Exit code
*/
public function executeCommand(array $args, OutputInterface $output, $message)
{
$name = $args[0];
$cmd = $this->getCmd($args);
$output->writeln('');
$output->writeln(sprintf('<info>Running %s</info>', $name));
$output->writeln(sprintf('<comment>%s</comment>', $cmd));
$this->process->setCommandLine($cmd);
$this->process->run(function ($type, $buffer) use($output, $cmd) {
if (Process::ERR === $type) {
$output->writeln(sprintf('<error>%s</error>', $buffer));
} else {
$output->writeln(sprintf('<comment>%s</comment>', $buffer));
}
});
if (!$this->process->isSuccessful()) {
throw new \RuntimeException($message . '<error>' . $this->process->getErrorOutput() . '</error>');
}
}
示例13: runProcess
/**
* @param string $commandline
* @return string
* @throws ProcessFailedException
*/
protected function runProcess($commandline)
{
if (null === $this->process) {
$this->process = new Process(null);
}
$this->process->setCommandLine($commandline);
$this->process->run();
if (!$this->process->isSuccessful()) {
throw new ProcessFailedException($this->process);
}
return trim($this->process->getOutput());
}
示例14: executeCommand
protected static function executeCommand($command)
{
$process = new Process(null);
$process->setCommandLine($command);
$process->setTimeout(300);
$process->run(function ($type, $buffer) {
echo $buffer;
});
if (!$process->isSuccessful()) {
throw new \RuntimeException(sprintf('An error occurred while executing \'%s\'.', $command));
}
}
示例15: start
public function start()
{
$seleniumUrl = $this->seleniumOptions->getSeleniumUrl();
$seleniumQuery = $this->seleniumOptions->getSeleniumQuery();
$seleniumJarLocation = $this->seleniumOptions->getSeleniumJarLocation();
if (!$seleniumUrl || !$seleniumQuery || !$seleniumJarLocation) {
throw new \LogicException('Url, Query and Selenium Jar Location is mandatory and Jar Location should point to a .jar file.');
}
if (!is_file($seleniumJarLocation)) {
throw new \RuntimeException('Selenium jar is not a file');
}
if (!is_readable($seleniumJarLocation)) {
throw new \RuntimeException('Selenium jar not readable - ' . $seleniumJarLocation);
}
if ($this->isSeleniumAvailable()) {
throw new \RuntimeException('Selenium was already started');
}
$this->setStartCommand($this->createStartCommand());
$this->process->setCommandLine($this->getStartCommand());
$this->process->start();
$this->responseWaitter->waitUntilAvailable($seleniumUrl, $seleniumQuery);
}