public function runLocally($commandline, $options = array())
{
if (is_array($commandline)) {
$os = php_uname('s');
if (preg_match('/Windows/i', $os)) {
$commandline = implode(" & ", $commandline);
} else {
$commandline = implode(" && ", $commandline);
}
}
$this->runtimeTask->getOutput()->writeln($this->getLocalInfoPrefix() . "<info>Run: </info>{$commandline}");
$realCommand = $this->compileRealCommand($commandline, $options, TRUE);
if ($this->runtimeTask->getOutput()->isVeryVerbose()) {
$this->runtimeTask->getOutput()->writeln($this->getLocalInfoPrefix() . "<info>Real command: </info>{$realCommand}");
}
$self = $this;
$symfonyProcess = new SymfonyProcess($realCommand);
if (isset($options["timeout"])) {
$symfonyProcess->setTimeout($options["timeout"]);
} else {
$symfonyProcess->setTimeout(null);
}
$resultContent = null;
$returnCode = $symfonyProcess->run(function ($type, $buffer) use($self, &$resultContent) {
$self->getRuntimeTask()->getOutput()->write($buffer);
$resultContent .= $buffer;
});
return new ProcessResult($returnCode, $resultContent);
}